Skip to content

TypeApply is a legal pattern value #6188

@nicolasstucki

Description

@nicolasstucki

The following compiles under dotty but fails in scalac.

class Foo {

  def foo[T]: Int = 9

  Option(9) match {
    case Some(foo[Int]) =>
  }

}

foo[Int] is taken as a value.
Which is translated as

matchResult1[Unit]: 
      {
        case val x1: Option[Int] = Option.apply[Int](9)
        if 
          x1.$isInstanceOf$[Some[Int]].&&(
            this.foo[Int].==(x1.$asInstanceOf$[Some[Int]].value)
          )
         then 
          return[matchResult1] 
            {
              ()
            }
         else ()
        throw new MatchError(x1)
      }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions