Skip to content

Commit d2cc3ae

Browse files
Space: Replace showType & make Space Showable (#19370)
Replace showType with a small tweak to RefinedPrinter, so the rest of the logic is followed. For instance, show infix types and tuples correctly. Also, make Space Showable, reusing the existing logic for Space, but additionally specifying the Space class name, which is important for following Space traces.
2 parents 2746ee8 + edc74b7 commit d2cc3ae

File tree

10 files changed

+107
-174
lines changed

10 files changed

+107
-174
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 87 additions & 147 deletions
Large diffs are not rendered by default.

compiler/test/dotty/tools/dotc/transform/patmat/SpaceEngineTest.scala

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ class SpaceEngineTest:
2727
val a = Prod(tp, unappTp, params)
2828
val b = Empty
2929

30-
val res1 = isSubspace(a, b)
30+
val res1 = a.isSubspace(b)
3131

32-
val a2 = simplify(a)
33-
val b2 = simplify(b)
32+
val a2 = a.simplify
33+
val b2 = b.simplify
3434
val rem1 = minus(a2, b2)
35-
val rem2 = simplify(rem1)
35+
val rem2 = rem1.simplify
3636
val res2 = rem2 == Empty
3737

3838
assertEquals(
@@ -46,19 +46,12 @@ class SpaceEngineTest:
4646
|simplify(rem1) == Empty
4747
|rem2 == Empty
4848
|
49-
|a = ${show(a)}
50-
|b = ${show(b)}
51-
|a2 = ${show(a2)}
52-
|b2 = ${show(b2)}
53-
|rem1 = ${show(rem1)}
54-
|rem2 = ${show(rem2)}
55-
|
56-
|a = ${a.toString}
57-
|b = ${b.toString}
58-
|a2 = ${a2.toString}
59-
|b2 = ${b2.toString}
60-
|rem1 = ${rem1.toString}
61-
|rem2 = ${rem2.toString}
49+
|a = $a
50+
|b = $b
51+
|a2 = $a2
52+
|b2 = $b2
53+
|rem1 = $rem1
54+
|rem2 = $rem2
6255
|
6356
|""".stripMargin, res1, res2)
6457
}

tests/patmat/aliasing.check

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
14: Pattern Match Exhaustivity: _: Trait & Test.Alias1, _: Clazz & Test.Alias1
2-
19: Pattern Match Exhaustivity: _: Trait & Test.Alias2
3-
23: Pattern Match Exhaustivity: _: Trait & (Test.Alias2 & OpenTrait2){val x: Int}
1+
14: Pattern Match Exhaustivity: _: Trait & Alias1, _: Clazz & Alias1
2+
19: Pattern Match Exhaustivity: _: Trait & Alias2
3+
23: Pattern Match Exhaustivity: _: Trait & (Alias2 & OpenTrait2){val x: Int}

tests/patmat/i12020.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19: Pattern Match Exhaustivity: _: TypeDef
1+
19: Pattern Match Exhaustivity: _: x$1.reflect.TypeDef

tests/patmat/i2502.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5: Pattern Match Exhaustivity: _: BTypes.ClassBType
1+
5: Pattern Match Exhaustivity: _: BTypes.this.ClassBType

tests/patmat/i2502b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5: Pattern Match Exhaustivity: _: BTypes.ClassBType
1+
5: Pattern Match Exhaustivity: _: BTypes.this.ClassBType

tests/patmat/i3938.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
34: Pattern Match Exhaustivity: bar.C()
1+
34: Pattern Match Exhaustivity: foo.bar.C()

tests/patmat/i6255b.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3: Pattern Match Exhaustivity: _: Expr[Int]
1+
3: Pattern Match Exhaustivity: _: scala.quoted.Expr[Int]

tests/patmat/t10100.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12: Pattern Match Exhaustivity: (_, FancyFoo(_))
1+
12: Pattern Match Exhaustivity: (_, NonExhaustive#FancyFoo(_))

tests/patmat/t9779.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
10: Pattern Match Exhaustivity: _: a.Elem[_]
1+
10: Pattern Match Exhaustivity: _: a.Elem[?]

0 commit comments

Comments
 (0)