Skip to content

Commit 3eb0fdd

Browse files
committed
Fix #2514; Survive non-sensical trees in Typer
Two problems here, because of previous parsing errors - We encounter a TypeTree() without expected type - We encounter a ValDef as an argument of an AppliedTypeTree
1 parent 1ee888a commit 3eb0fdd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,8 +1056,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
10561056
throw ex
10571057
}
10581058
case _ =>
1059-
assert(isFullyDefined(pt, ForceDegree.none))
1060-
tree.withType(pt)
1059+
tree.withType(
1060+
if (isFullyDefined(pt, ForceDegree.none)) pt else UnspecifiedErrorType)
10611061
}
10621062
}
10631063

@@ -1124,7 +1124,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
11241124
tparam.ensureCompleted()
11251125
case _ =>
11261126
}
1127-
typed(desugaredArg, argPt)
1127+
if (desugaredArg.isType) typed(desugaredArg, argPt)
1128+
else desugaredArg.withType(UnspecifiedErrorType)
11281129
}
11291130
args.zipWithConserve(tparams)(typedArg(_, _)).asInstanceOf[List[Tree]]
11301131
}

0 commit comments

Comments
 (0)