Skip to content

Commit 20a9b96

Browse files
committed
Add captDebug printer
1 parent 8883176 commit 20a9b96

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

compiler/src/dotty/tools/dotc/cc/CaptureSet.scala

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -529,20 +529,19 @@ 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
536-
else !levelLimit.exists
537-
|| elem.match
538-
case elem: TermRef =>
539-
var sym = elem.symbol
540-
if sym.isLevelOwner then sym = sym.owner
541-
levelLimit.isContainedIn(sym.levelOwner)
542-
case elem: ThisType =>
543-
levelLimit.isContainedIn(elem.cls.levelOwner)
544-
case _ =>
545-
true
532+
else elem match
533+
case elem: TermRef =>
534+
if levelLimit.exists then
535+
var sym = elem.symbol
536+
if sym.isLevelOwner then sym = sym.owner
537+
levelLimit.isContainedIn(sym.levelOwner)
538+
else true
539+
case elem: ThisType =>
540+
if levelLimit.exists then
541+
levelLimit.isContainedIn(elem.cls.levelOwner)
542+
else true
543+
case elem: TermParamRef =>
544+
true
546545

547546
def addDependent(cs: CaptureSet)(using Context, VarState): CompareResult =
548547
if (cs eq this) || cs.isUniversal || isConst then

compiler/src/dotty/tools/dotc/cc/Setup.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Contexts.*, Names.*, Flags.*, Symbols.*, Decorators.*
88
import Types.*, StdNames.*
99
import Annotations.Annotation
1010
import config.Feature
11-
import config.Printers.capt
11+
import config.Printers.{capt, captDebug}
1212
import ast.tpd, tpd.*
1313
import transform.{PreRecheck, Recheck}, Recheck.*
1414
import CaptureSet.{IdentityCaptRefMap, IdempotentCaptRefMap}
@@ -595,7 +595,7 @@ class Setup extends PreRecheck, SymTransformer, SetupAPI:
595595
needsVariable(parent)
596596
case _ =>
597597
false
598-
}.showing(i"can have inferred capture $tp = $result", capt)
598+
}.showing(i"can have inferred capture $tp = $result", captDebug)
599599

600600
/** Pull out an embedded capture set from a part of `tp` */
601601
def normalizeCaptures(tp: Type)(using Context): Type = tp match

compiler/src/dotty/tools/dotc/config/Printers.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ object Printers {
2222
if ctx.settings.YccLog.value then captActive else noPrinter
2323
val captActive = new Printer
2424

25+
def captDebug(using Context): Printer =
26+
if ctx.settings.YccDebug.value then captDebugActive else noPrinter
27+
val captDebugActive = new Printer
28+
2529
val constr = noPrinter
2630
val core = noPrinter
2731
val checks = noPrinter

compiler/src/dotty/tools/dotc/core/ConstraintHandling.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ trait ConstraintHandling {
5454
protected var homogenizeArgs: Boolean = false
5555

5656
/** We are currently comparing type lambdas. Used as a flag for
57-
* optimization: when `false`, no need to do an expensive `pruneLambdaParams`
57+
* optimization: when `false`, no need to do an expensive `avoidLambdaParams`
5858
*/
5959
protected var comparedTypeLambdas: Set[TypeLambda] = Set.empty
6060

0 commit comments

Comments
 (0)