Skip to content

Commit

Permalink
Embed accountsFor info in regular explain traces
Browse files Browse the repository at this point in the history
  • Loading branch information
odersky committed Sep 13, 2024
1 parent 39c5392 commit 9660869
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions compiler/src/dotty/tools/dotc/cc/CaptureSet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,13 @@ sealed abstract class CaptureSet extends Showable:
* as frozen.
*/
def accountsFor(x: CaptureRef)(using Context): Boolean =
if comparer.isInstanceOf[ExplainingTypeComparer] then // !!! DEBUG
reporting.trace.force(i"$this accountsFor $x, ${x.captureSetOfInfo}?", show = true):
elems.exists(_.subsumes(x))
|| !x.isMaxCapability && x.captureSetOfInfo.subCaptures(this, frozen = true).isOK
else
reporting.trace(i"$this accountsFor $x, ${x.captureSetOfInfo}?", show = true):
elems.exists(_.subsumes(x))
|| !x.isMaxCapability && x.captureSetOfInfo.subCaptures(this, frozen = true).isOK
def debugInfo(using Context) = i"$this accountsFor $x, which has capture set ${x.captureSetOfInfo}"
def test(using Context) = reporting.trace(debugInfo):
elems.exists(_.subsumes(x))
|| !x.isMaxCapability && x.captureSetOfInfo.subCaptures(this, frozen = true).isOK
comparer match
case comparer: ExplainingTypeComparer => comparer.traceIndented(debugInfo)(test)
case _ => test

/** A more optimistic version of accountsFor, which does not take variable supersets
* of the `x` reference into account. A set might account for `x` if it accounts
Expand Down

0 comments on commit 9660869

Please sign in to comment.