@@ -4,7 +4,7 @@ package cc
4
4
5
5
import core .*
6
6
import Types .* , Symbols .* , Flags .* , Contexts .* , Decorators .*
7
- import config .Printers .capt
7
+ import config .Printers .{ capt , captDebug }
8
8
import Annotations .Annotation
9
9
import annotation .threadUnsafe
10
10
import annotation .constructorOnly
@@ -515,7 +515,7 @@ object CaptureSet:
515
515
else if ! levelOK(elem) then
516
516
CompareResult .LevelError (this , elem)
517
517
else
518
- // assert( id != 19 || !elem.isLocalRootCapability, elem.asInstanceOf[TermRef].localRootOwner )
518
+ // if id == 34 then assert( !elem.isUniversalRootCapability )
519
519
elems += elem
520
520
if elem.isUniversalRootCapability then
521
521
rootAddedHandler()
@@ -529,6 +529,10 @@ object CaptureSet:
529
529
530
530
private def levelOK (elem : CaptureRef )(using Context ): Boolean =
531
531
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
532
536
else ! levelLimit.exists
533
537
|| elem.match
534
538
case elem : TermRef =>
@@ -537,7 +541,8 @@ object CaptureSet:
537
541
levelLimit.isContainedIn(sym.levelOwner)
538
542
case elem : ThisType =>
539
543
levelLimit.isContainedIn(elem.cls.levelOwner)
540
- case _ => true
544
+ case _ =>
545
+ true
541
546
542
547
def addDependent (cs : CaptureSet )(using Context , VarState ): CompareResult =
543
548
if (cs eq this ) || cs.isUniversal || isConst then
@@ -738,9 +743,10 @@ object CaptureSet:
738
743
else if accountsFor(elem) then
739
744
CompareResult .OK
740
745
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)
744
750
745
751
/** For a BiTypeMap, supertypes of the mapped type also constrain
746
752
* the source via the inverse type mapping and vice versa. That is, if
@@ -1037,7 +1043,7 @@ object CaptureSet:
1037
1043
case _ =>
1038
1044
empty
1039
1045
recur(tp)
1040
- .showing(i " capture set of $tp = $result" , capt )
1046
+ .showing(i " capture set of $tp = $result" , captDebug )
1041
1047
1042
1048
private val ShownVars : Property .Key [mutable.Set [Var ]] = Property .Key ()
1043
1049
0 commit comments