Skip to content

Commit ae3b271

Browse files
Normalize for underlyingClassRef
Related to scala#20258 Here too, I would be fine with not normalizing, but in that case pos/i15827 should become a neg test.
1 parent 05114dd commit ae3b271

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,8 @@ object Types extends TypeUtils {
15841584
else if (tp.symbol.isAliasType) tp.underlying.underlyingClassRef(refinementOK)
15851585
else NoType
15861586
case tp: AppliedType =>
1587-
if (tp.tycon.isLambdaSub) NoType
1587+
if tp.isMatchAlias then tp.tryNormalize.underlyingClassRef(refinementOK)
1588+
else if (tp.tycon.isLambdaSub) NoType
15881589
else tp.superType.underlyingClassRef(refinementOK)
15891590
case tp: AnnotatedType =>
15901591
tp.parent.underlyingClassRef(refinementOK)

tests/pos/i15827b/A_1.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
case class Foo()
3+
4+
type T = Tuple.Elem[(Foo, Any), 0]
5+
type U = Tuple.Elem[(Any, T), 1]
6+
7+
val _ = new T() // ok
8+
val _ = new U() // ok

tests/pos/i15827b/B_2.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
val _ = new T() // was error
3+
val _ = new U() // was error

0 commit comments

Comments
 (0)