File tree 1 file changed +9
-0
lines changed
compiler/src/dotty/tools/dotc/transform/patmat
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -524,13 +524,22 @@ object SpaceEngine {
524
524
val mt : MethodType = unapp.widen match {
525
525
case mt : MethodType => mt
526
526
case pt : PolyType =>
527
+ val locked = ctx.typerState.ownedVars
527
528
val tvars = constrained(pt)
528
529
val mt = pt.instantiate(tvars).asInstanceOf [MethodType ]
529
530
scrutineeTp <:< mt.paramInfos(0 )
530
531
// force type inference to infer a narrower type: could be singleton
531
532
// see tests/patmat/i4227.scala
532
533
mt.paramInfos(0 ) <:< scrutineeTp
533
534
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 )
534
543
mt
535
544
}
536
545
You can’t perform that action at this time.
0 commit comments