Skip to content

Commit 4b7c7e3

Browse files
committed
Fix a compiler assertion crash
1 parent 275cfa8 commit 4b7c7e3

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-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
@@ -2633,7 +2633,8 @@ object Types {
26332633
}
26342634
}
26352635
if (prefix.isInstanceOf[WildcardType]) WildcardType
2636-
else withPrefix(prefix)
2636+
else if prefix.isValueTypeOrWildcard || (prefix eq NoPrefix) then withPrefix(prefix)
2637+
else typer.ErrorReporting.errorType(i"Cannot ($this).deriveSelect($prefix)", ctx.tree)
26372638
}
26382639

26392640
/** A reference like this one, but with the given symbol, if it exists */

tests/neg/i12448.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Main {
2+
def mkArray[T <: A]: T#AType // error // error
3+
mkArray[Array] // was: "assertion failed: invalid prefix HKTypeLambda..."
4+
}

0 commit comments

Comments
 (0)