Skip to content

incorrect type checking in pattern matching #1255

Closed
@liufengyun

Description

@liufengyun

Following code passes type checking in dotty:

object Test {
  def foo(x: Option[Int]) = x match {
    case Some(_: Double) => true
    case None => true
  }
}

In scalac it generates following error message:

error: scrutinee is incompatible with pattern type;
 found   : Double
 required: Int
    case Some(_: Double) => true
                 ^
one error found

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions