File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -1929,13 +1929,21 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
19291929 NoType
19301930 }
19311931
1932- if pt.existsPart(_.isInstanceOf [TypeVar ], StopAt .Static )
1933- && untpd.isFunctionWithUnknownParamType(tree)
1934- && ! calleeType.exists then
1932+ def instantiateInUnion (tp : Type ): Unit = tp match
1933+ case tp : OrType =>
1934+ instantiateInUnion(tp.tp1)
1935+ instantiateInUnion(tp.tp2)
1936+ case tp : FlexibleType =>
1937+ instantiateInUnion(tp.hi)
1938+ case tp : TypeVar =>
1939+ isFullyDefined(tp, ForceDegree .flipBottom)
1940+ case _ =>
1941+
1942+ if untpd.isFunctionWithUnknownParamType(tree) && ! calleeType.exists then
19351943 // try to instantiate `pt` if this is possible. If it does not
19361944 // work the error will be reported later in `inferredParam`,
19371945 // when we try to infer the parameter type.
1938- isFullyDefined (pt, ForceDegree .flipBottom )
1946+ instantiateInUnion (pt)
19391947
19401948 val (protoFormals, resultTpt) = decomposeProtoFunction(pt, params.length, tree.srcPos)
19411949
You can’t perform that action at this time.
0 commit comments