File tree 2 files changed +21
-1
lines changed
src/dotty/tools/dotc/transform/patmat
test/dotty/tools/dotc/reporting
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -790,7 +790,8 @@ object SpaceEngine {
790
790
791
791
def doShow (s : Space , flattenList : Boolean = false ): String = s match {
792
792
case Empty => " empty"
793
- case Typ (c : ConstantType , _) => " " + c.value.value
793
+ case Typ (ConstantType (const : Constant ), _) if const.tag == StringTag => " \" " + const.value + " \" "
794
+ case Typ (ConstantType (const : Constant ), _) => " " + const.value
794
795
case Typ (tp : TermRef , _) =>
795
796
if (flattenList && tp <:< defn.NilType ) " "
796
797
else tp.symbol.showName
Original file line number Diff line number Diff line change @@ -100,6 +100,25 @@ class CodeActionTest extends DottyTest:
100
100
afterPhase = " patternMatcher"
101
101
)
102
102
103
+ @ Test def insertMissingCasesForUnionIntType =
104
+ checkCodeAction(
105
+ code =
106
+ """ object Test:
107
+ | def foo(text: 1 | 2) = text match {
108
+ | case 2 => ???
109
+ | }
110
+ |""" .stripMargin,
111
+ title = " Insert missing cases (1)" ,
112
+ expected =
113
+ """ object Test:
114
+ | def foo(text: 1 | 2) = text match {
115
+ | case 2 => ???
116
+ | case 1 => ???
117
+ | }
118
+ |""" .stripMargin,
119
+ afterPhase = " patternMatcher"
120
+ )
121
+
103
122
// Make sure we're not using the default reporter, which is the ConsoleReporter,
104
123
// meaning they will get reported in the test run and that's it.
105
124
private def newContext =
You can’t perform that action at this time.
0 commit comments