Skip to content

No static check for pattern match on Identifiers #9166

Closed
@bishabosha

Description

@bishabosha

Minimized code

object UnitTest extends App {
  def foo(m: Unit) = m match {
    case runtime.BoxedUnit.UNIT => println("ok")
  }
  foo(())
}

Output

compiles and prints "ok"

Expectation

error like in Scala 2

UnitTest.scala:4: error: type mismatch;
 found   : scala.runtime.BoxedUnit
 required: Unit
    case runtime.BoxedUnit.UNIT => println("ok")
                           ^
1 error

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions