File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -4255,11 +4255,18 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
4255
4255
if ((! formal.isGround) && (formal.simplified `ne` formal) && (pt1 `ne` pt) && (pt1 ne sharpenedPt) && (ownedVars ne locked) && ! ownedVars.isEmpty) {
4256
4256
val qualifying = (ownedVars -- locked).toList
4257
4257
if (qualifying.nonEmpty) {
4258
+ val approxRes = wildApprox(pt1.resultType)
4259
+ val tm = new TypeMap :
4260
+ def apply (t : Type ) = t match
4261
+ case fp@ FunProto (args, resType) =>
4262
+ fp.derivedFunProto(args.map(a => dummyArg(a.typeOpt).withSpan(a.span)), mapOver(resType))
4263
+ case _ =>
4264
+ mapOver(t)
4258
4265
val resultAlreadyConstrained = pt1.isInstanceOf [MethodOrPoly ]
4259
4266
if (! resultAlreadyConstrained) {
4260
4267
if ctx.typerState.isCommittable then
4261
- NoViewsAllowed .constrainResult(tree.symbol, wtp, pt1 )
4262
- else constrainResult(tree.symbol, wtp, pt1 )
4268
+ NoViewsAllowed .constrainResult(tree.symbol, wtp.resultType, tm(approxRes) )
4269
+ else constrainResult(tree.symbol, wtp.resultType, tm(approxRes) )
4263
4270
}
4264
4271
}
4265
4272
}
You can’t perform that action at this time.
0 commit comments