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 @@ -533,13 +533,22 @@ object SpaceEngine {
533
533
val mt : MethodType = unapp.widen match {
534
534
case mt : MethodType => mt
535
535
case pt : PolyType =>
536
+ val locked = ctx.typerState.ownedVars
536
537
val tvars = constrained(pt)
537
538
val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
538
539
scrutineeTp <:< mt.paramInfos(0 )
539
540
// force type inference to infer a narrower type: could be singleton
540
541
// see tests/patmat/i4227.scala
541
542
mt.paramInfos(0 ) <:< scrutineeTp
542
543
maximizeType(mt.paramInfos(0 ), Spans .NoSpan )
544
+ if ! (ctx.typerState.ownedVars -- locked).isEmpty then
545
+ // constraining can create type vars out of wildcard types
546
+ // (in legalBound, by using a LevelAvoidMap)
547
+ // maximise will only do one pass at maximising the type vars in the target type
548
+ // which means we can maximise to types that include other type vars
549
+ // this fails TreeChecker's "non-empty constraint at end of $fusedPhase" check
550
+ // e.g. run-macros/string-context-implicits
551
+ maximizeType(mt.paramInfos(0 ), Spans .NoSpan )
543
552
mt
544
553
}
545
554
You can’t perform that action at this time.
0 commit comments