from commit 6be96724899f9c34db2e6c2617534dc9c4a15528:
Following type aliases when pattern matching.
Faced with a pattern like
Apply(x, xs)
we first look for an Apply object which is an extractor. If this fails, we now
interprete Apply as a type. If it is a type alias which points to a class type that
has a companion module, we then try that companion module as an extractor.
Scala 2.x does ot that way, and it's used widely within dotty itself. Think tpd.Apply as the found object,
Trees.Apply as the extractor.
Also, added a fix to normalization which made normalization go deep into a method type.
scala> case class Foo(x: Int)
// defined case class Foo
scala> object inst:
| type FooAlias = Foo
|
// defined object inst
scala> def foo(t: inst.FooAlias) = t match
| case inst.FooAlias(x) => x
|
def foo(t: inst.FooAlias): Int
from commit 6be96724899f9c34db2e6c2617534dc9c4a15528:
found by @smarter https://github.com/lampepfl/dotty/blob/7723864d3669cea8bba7481d3b62eaf7e560c2bf/compiler/src/dotty/tools/dotc/typer/Applications.scala#L1198-L1200
Example