Skip to content

Commit 784e5af

Browse files
Normalize for underlyingClassRef
Test #15827 with a classpath dependency
1 parent 17777db commit 784e5af

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-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
@@ -1584,7 +1584,7 @@ object Types extends TypeUtils {
15841584
* a class, the class type ref, otherwise NoType.
15851585
* @param refinementOK If `true` we also skip refinements.
15861586
*/
1587-
def underlyingClassRef(refinementOK: Boolean)(using Context): Type = dealias match {
1587+
def underlyingClassRef(refinementOK: Boolean)(using Context): Type = dealiasNormalized match {
15881588
case tp: TypeRef =>
15891589
if (tp.symbol.isClass) tp
15901590
else if (tp.symbol.isAliasType) tp.underlying.underlyingClassRef(refinementOK)
File renamed without changes.

tests/pos/i15827b/A_1.scala

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

tests/pos/i15827b/B_2.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
val y = new T() // error before changes

0 commit comments

Comments
 (0)