Skip to content

Patmat: dotty does not generate null checks for extractors #1335

Closed
@DarkDimius

Description

@DarkDimius
object Test {
 case class MyTuple(a: Int, b: Int)
 def foo = MyTuple(1,2)
 def main(args: Array[String]): Unit = {
   val MyTuple(a,b) = null // should throw MatchError. Throws NPE instead.
   println(a + b)
 }
}

Scala2 style option-based pattern matching is handled correctly. This bug only happens with option-less pattern matching.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions