Skip to content

Commit a268557

Browse files
committed
Make transluctentSuperType handle match types
This fixes several erasure related things, such as signature, or erasure itself. Fixes #8666
1 parent 3bcdc34 commit a268557

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4011,7 +4011,7 @@ object Types {
40114011
case tycon: TypeRef if tycon.symbol.isOpaqueAlias =>
40124012
tycon.translucentSuperType.applyIfParameterized(args)
40134013
case _ =>
4014-
superType
4014+
tryNormalize.orElse(superType)
40154015
}
40164016

40174017
inline def map(inline op: Type => Type)(using Context) =

tests/pos/i8666.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Foo[A, B]()
2+
3+
type FooSnd[X] = X match
4+
case Foo[_, b] => b
5+
6+
trait Bar[A]:
7+
def bar(h: FooSnd[A]): Int
8+
9+
val foo: Bar[Foo[String, Int]] = new Bar[Foo[String, Int]]:
10+
def bar(h: FooSnd[Foo[String, Int]]) = h

0 commit comments

Comments
 (0)