File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
src/dotty/tools/dotc/transform/patmat
test/dotty/tools/dotc/reporting Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -786,7 +786,8 @@ object SpaceEngine {
786786
787787 def doShow (s : Space , flattenList : Boolean = false ): String = s match {
788788 case Empty => " empty"
789- case Typ (c : ConstantType , _) => " " + c.value.value
789+ case Typ (ConstantType (const : Constant ), _) if const.tag == StringTag => " \" " + const.value + " \" "
790+ case Typ (ConstantType (const : Constant ), _) => " " + const.value
790791 case Typ (tp : TermRef , _) =>
791792 if (flattenList && tp <:< defn.NilType ) " "
792793 else tp.symbol.showName
Original file line number Diff line number Diff line change @@ -100,6 +100,25 @@ class CodeActionTest extends DottyTest:
100100 afterPhase = " patternMatcher"
101101 )
102102
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+
103122 // Make sure we're not using the default reporter, which is the ConsoleReporter,
104123 // meaning they will get reported in the test run and that's it.
105124 private def newContext =
You can’t perform that action at this time.
0 commit comments