Skip to content

Commit 278adf1

Browse files
committed
Survive malformed type parameters gracefully
1 parent a5bc503 commit 278adf1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,8 +1677,10 @@ class Namer { typer: Typer =>
16771677
// 5. Info of CP is copied to DP and DP is completed.
16781678
index(ddef.leadingTypeParams)
16791679
if (isConstructor) sym.owner.typeParams.foreach(_.ensureCompleted())
1680-
completer.setCompletedTypeParams(
1681-
for tparam <- ddef.leadingTypeParams yield typedAheadExpr(tparam).symbol.asType)
1680+
val completedTypeParams =
1681+
for tparam <- ddef.leadingTypeParams yield typedAheadExpr(tparam).symbol
1682+
if completedTypeParams.forall(_.isType) then
1683+
completer.setCompletedTypeParams(completedTypeParams.asInstanceOf[List[TypeSymbol]])
16821684
ddef.trailingParamss.foreach(completeParams)
16831685
val paramSymss = normalizeIfConstructor(ddef.paramss.nestedMap(symbolOfTree), isConstructor)
16841686
sym.setParamss(paramSymss)

0 commit comments

Comments
 (0)