Skip to content

Commit

Permalink
Fix Space traces
Browse files Browse the repository at this point in the history
  • Loading branch information
dwijnand committed Feb 12, 2024
1 parent 206b28d commit dfb064b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ object SpaceEngine {
def decompose(typ: Typ)(using Context): List[Typ] = typ.decompose

/** Simplify space such that a space equal to `Empty` becomes `Empty` */
def computeSimplify(space: Space)(using Context): Space = trace(s"simplify($space)")(space match {
def computeSimplify(space: Space)(using Context): Space = trace(i"simplify($space)")(space match {
case Prod(tp, fun, spaces) =>
val sps = spaces.mapconserve(simplify)
if sps.contains(Empty) then Empty
Expand Down Expand Up @@ -166,7 +166,7 @@ object SpaceEngine {
}

/** Is `a` a subspace of `b`? Equivalent to `simplify(simplify(a) - simplify(b)) == Empty`, but faster */
def computeIsSubspace(a: Space, b: Space)(using Context): Boolean = trace(s"isSubspace($a, $b)") {
def computeIsSubspace(a: Space, b: Space)(using Context): Boolean = trace(i"isSubspace($a, $b)") {
val a2 = simplify(a)
val b2 = simplify(b)
if (a ne a2) || (b ne b2) then isSubspace(a2, b2)
Expand Down Expand Up @@ -195,7 +195,7 @@ object SpaceEngine {
}

/** Intersection of two spaces */
def intersect(a: Space, b: Space)(using Context): Space = trace(s"$a & $b") {
def intersect(a: Space, b: Space)(using Context): Space = trace(i"intersect($a & $b)") {
(a, b) match {
case (Empty, _) | (_, Empty) => Empty
case (_, Or(ss)) => Or(ss.map(intersect(a, _)).filter(_ ne Empty))
Expand All @@ -220,7 +220,7 @@ object SpaceEngine {
}

/** The space of a not covered by b */
def minus(a: Space, b: Space)(using Context): Space = trace(s"$a - $b") {
def minus(a: Space, b: Space)(using Context): Space = trace(i"minus($a - $b)") {
(a, b) match {
case (Empty, _) => Empty
case (_, Empty) => a
Expand Down

0 comments on commit dfb064b

Please sign in to comment.