File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
compiler/src/dotty/tools/dotc/transform/patmat Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -524,13 +524,22 @@ object SpaceEngine {
524524 val mt : MethodType = unapp.widen match {
525525 case mt : MethodType => mt
526526 case pt : PolyType =>
527+ val locked = ctx.typerState.ownedVars
527528 val tvars = constrained(pt)
528529 val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
529530 scrutineeTp <:< mt.paramInfos(0 )
530531 // force type inference to infer a narrower type: could be singleton
531532 // see tests/patmat/i4227.scala
532533 mt.paramInfos(0 ) <:< scrutineeTp
533534 maximizeType(mt.paramInfos(0 ), Spans .NoSpan )
535+ if ! (ctx.typerState.ownedVars -- locked).isEmpty then
536+ // constraining can create type vars out of wildcard types
537+ // (in legalBound, by using a LevelAvoidMap)
538+ // maximise will only do one pass at maximising the type vars in the target type
539+ // which means we can maximise to types that include other type vars
540+ // this fails TreeChecker's "non-empty constraint at end of $fusedPhase" check
541+ // e.g. run-macros/string-context-implicits
542+ maximizeType(mt.paramInfos(0 ), Spans .NoSpan )
534543 mt
535544 }
536545
You can’t perform that action at this time.
0 commit comments