Skip to content

Commit

Permalink
bugfix: Retain partial type params typying information on error
Browse files Browse the repository at this point in the history
Fixes #15750
  • Loading branch information
tgodzik committed Aug 5, 2022
1 parent 44a2f72 commit 90af6fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1993,7 +1993,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
typed(tree.tpt, AnyTypeConstructorProto)
}
val tparams = tpt1.tpe.typeParams
if (tparams.isEmpty) {
if tpt1.tpe.isError then
val args1 = tree.args.mapconserve(typedType(_))
assignType(cpy.AppliedTypeTree(tree)(tpt1, args1), tpt1, args1)
else if (tparams.isEmpty) {
report.error(TypeDoesNotTakeParameters(tpt1.tpe, tree.args), tree.srcPos)
tpt1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1518,4 +1518,14 @@ class CompletionTest {
.noCompletions()
}

@Test def badTypeCompletions: Unit = {
code"""trait Foo
|object Test:
| def foo: ArrayBuffer[Fo${m1}] = ???
"""
.completion(m1, Set(
("Foo",Class,"Foo")
)
)
}
}

0 comments on commit 90af6fe

Please sign in to comment.