Skip to content

Commit 3e17aa0

Browse files
committed
Fix a compiler assertion crash
1 parent 275cfa8 commit 3e17aa0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ object Substituters:
153153
if (tp.binder == from) to(tp.paramNum) else tp
154154
case tp: NamedType =>
155155
if (tp.prefix `eq` NoPrefix) tp
156-
else tp.derivedSelect(substParams(tp.prefix, from, to, theMap))
156+
else
157+
val pre1 = substParams(tp.prefix, from, to, theMap)
158+
if pre1.isValueTypeOrWildcard || (pre1 eq NoPrefix) then tp.derivedSelect(pre1)
159+
else tp
157160
case _: ThisType =>
158161
tp
159162
case tp: AppliedType =>

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)