Skip to content

Commit 6fa2a3e

Browse files
committed
Refine type assignment of TypeApply
Disambiguation with expected PolyType has to be done not only in the final type, but also in the function part of the tree.
1 parent 239ec17 commit 6fa2a3e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,11 @@ trait TypeAssigner {
439439
tree.withType(err)
440440
case ref: TermRef if ref.isOverloaded =>
441441
val disambiguated = ref.denot.suchThat(_.info.isInstanceOf[PolyType])
442-
if (disambiguated.exists) assignType(tree, fn.withType(ref.withDenot(disambiguated)), args)
442+
if (disambiguated.exists) {
443+
val fn1 = fn.withType(ref.withDenot(disambiguated))
444+
val tree1 = untpd.cpy.TypeApply(tree)(fn1, args)
445+
assignType(tree1, fn1, args)
446+
}
443447
else fail
444448
case _ =>
445449
//println(i"bad type: $fn: ${fn.symbol} / ${fn.symbol.isType} / ${fn.symbol.info}") // DEBUG

0 commit comments

Comments
 (0)