@@ -4,7 +4,7 @@ package cc
44
55import core .*
66import Types .* , Symbols .* , Flags .* , Contexts .* , Decorators .*
7- import config .Printers .capt
7+ import config .Printers .{ capt , captDebug }
88import Annotations .Annotation
99import annotation .threadUnsafe
1010import annotation .constructorOnly
@@ -515,7 +515,7 @@ object CaptureSet:
515515 else if ! levelOK(elem) then
516516 CompareResult .LevelError (this , elem)
517517 else
518- // assert( id != 19 || !elem.isLocalRootCapability, elem.asInstanceOf[TermRef].localRootOwner )
518+ // if id == 34 then assert( !elem.isUniversalRootCapability )
519519 elems += elem
520520 if elem.isUniversalRootCapability then
521521 rootAddedHandler()
@@ -529,6 +529,10 @@ object CaptureSet:
529529
530530 private def levelOK (elem : CaptureRef )(using Context ): Boolean =
531531 if elem.isUniversalRootCapability then ! noUniversal
532+ else if elem.isInstanceOf [TermParamRef ] then
533+ // println(i"can't include $elem in $this")
534+ // new Error().printStackTrace()
535+ ! ctx.settings.YccNew .value
532536 else ! levelLimit.exists
533537 || elem.match
534538 case elem : TermRef =>
@@ -537,7 +541,8 @@ object CaptureSet:
537541 levelLimit.isContainedIn(sym.levelOwner)
538542 case elem : ThisType =>
539543 levelLimit.isContainedIn(elem.cls.levelOwner)
540- case _ => true
544+ case _ =>
545+ true
541546
542547 def addDependent (cs : CaptureSet )(using Context , VarState ): CompareResult =
543548 if (cs eq this ) || cs.isUniversal || isConst then
@@ -738,9 +743,10 @@ object CaptureSet:
738743 else if accountsFor(elem) then
739744 CompareResult .OK
740745 else
741- addNewElem(elem).andAlso:
742- source.tryInclude(bimap.backward(elem), this )
743- .showing(i " propagating new elem $elem backward from $this to $source" , capt)
746+ source.tryInclude(bimap.backward(elem), this )
747+ .showing(i " propagating new elem $elem backward from $this to $source = $result" , capt)
748+ .andAlso:
749+ addNewElem(elem)
744750
745751 /** For a BiTypeMap, supertypes of the mapped type also constrain
746752 * the source via the inverse type mapping and vice versa. That is, if
@@ -1037,7 +1043,7 @@ object CaptureSet:
10371043 case _ =>
10381044 empty
10391045 recur(tp)
1040- .showing(i " capture set of $tp = $result" , capt )
1046+ .showing(i " capture set of $tp = $result" , captDebug )
10411047
10421048 private val ShownVars : Property .Key [mutable.Set [Var ]] = Property .Key ()
10431049
0 commit comments