diff options
59 files changed, 288 insertions, 458 deletions
diff --git a/docs/_includes/features.html b/docs/_includes/features.html index bbba6d54c..ba004d68b 100644 --- a/docs/_includes/features.html +++ b/docs/_includes/features.html @@ -49,8 +49,8 @@ <td>Implemented</td> </tr> <tr class="odd"> - <td></td> - <td></td> + <td>Exhaustivity checks in pattern matching</td> + <td>Implemented</td> </tr> <tr class="even"> <td>Non-boxed arrays of value classes</td> @@ -92,14 +92,9 @@ <td>Spec Option-less pattern matching</td> <td>Considered</td> </tr> - <tr class="even"> - <td>Exhaustivity checks in pattern matching</td> - <td>Considered</td> - </tr> </tbody> </table> </div> - <p>The complete list is available <a href="https://github.com/lampepfl/dotty#what-are-the-features-that-could-make-me-consider-trying-it">here</a>.</p> <h1 id="talks-on-dotty">Talks on Dotty?</h1> <ul> <li><a href="https://www.youtube.com/watch?v=WxyyJyB_Ssc">Compilers are Databases</a> by Martin Odersky (<a href="http://www.slideshare.net/Odersky/compilers-are-databases">slides</a>)</li> diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala index 639dac930..349fbfb2c 100644 --- a/src/dotty/tools/dotc/ast/Desugar.scala +++ b/src/dotty/tools/dotc/ast/Desugar.scala @@ -615,8 +615,7 @@ object desugar { */ def makeClosure(params: List[ValDef], body: Tree, tpt: Tree = TypeTree(), inlineable: Boolean)(implicit ctx: Context) = { var mods = synthetic - if (inlineable) - mods = mods.withAddedAnnotation(New(ref(defn.InlineAnnotType), Nil).withPos(body.pos)) + if (inlineable) mods |= Inline Block( DefDef(nme.ANON_FUN, Nil, params :: Nil, tpt, body).withMods(mods), Closure(Nil, Ident(nme.ANON_FUN), EmptyTree)) diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index a25be0a1f..fb6a40100 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -751,10 +751,7 @@ object SymDenotations { // def isOverridable: Boolean = !!! need to enforce that classes cannot be redefined def isSkolem: Boolean = name == nme.SKOLEM - def isInlineMethod(implicit ctx: Context): Boolean = - is(Method, butNot = Accessor) && - !isCompleting && // don't force method type; recursive inlines are ignored anyway. - hasAnnotation(defn.InlineAnnot) + def isInlineMethod(implicit ctx: Context): Boolean = is(InlineMethod, butNot = Accessor) // ------ access to related symbols --------------------------------- diff --git a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala index a0d788955..d2605afea 100644 --- a/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala +++ b/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala @@ -474,7 +474,7 @@ class TreeUnpickler(reader: TastyReader, tastyName: TastyName.Table, posUnpickle sym.completer.withDecls(newScope) forkAt(templateStart).indexTemplateParams()(localContext(sym)) } - else if (annots.exists(_.symbol == defn.InlineAnnot)) + else if (sym.isInlineMethod) sym.addAnnotation(LazyBodyAnnotation { ctx0 => implicit val ctx: Context = localContext(sym)(ctx0).addMode(Mode.ReadPositions) // avoids space leaks by not capturing the current context diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala index f442c13b3..ef4c970c6 100644 --- a/src/dotty/tools/dotc/parsing/Parsers.scala +++ b/src/dotty/tools/dotc/parsing/Parsers.scala @@ -151,7 +151,7 @@ object Parsers { /* ------------- ERROR HANDLING ------------------------------------------- */ /** The offset of the last time when a statement on a new line was definitely - * encountered in the current scope or an outer scope\ + * encountered in the current scope or an outer scope. */ private var lastStatOffset = -1 @@ -505,7 +505,7 @@ object Parsers { if (t1 ne t) t1 else dotSelectors(selector(t), finish) } - /** Dotelectors ::= { `.' ident() + /** DotSelectors ::= { `.' ident() * * Accept `.' separated identifiers acting as a selectors on given tree `t`. * @param finish An alternative parse in case the token following a `.' is not an identifier. @@ -521,7 +521,7 @@ object Parsers { * | [Ident `.'] this * * @param thisOK If true, [Ident `.'] this is acceptable as the path. - * If false, another selection is required aftre the `this`. + * If false, another selection is required after the `this`. * @param finish An alternative parse in case the token following a `.' is not an identifier. * If the alternative does not apply, its tree argument is returned unchanged. */ diff --git a/src/dotty/tools/dotc/reporting/diagnostic/Message.scala b/src/dotty/tools/dotc/reporting/diagnostic/Message.scala index 8b1f65673..8b607c18c 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/Message.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/Message.scala @@ -18,7 +18,8 @@ object Message { /** A `Message` contains all semantic information necessary to easily * comprehend what caused the message to be logged. Each message can be turned * into a `MessageContainer` which contains the log level and can later be - * consumed by a subclass of `Reporter`. + * consumed by a subclass of `Reporter`. However, the error position is only + * part of `MessageContainer`, not `Message`. * * @param errorId a unique number identifying the message, this will later be * used to reference documentation online @@ -31,7 +32,7 @@ abstract class Message(val errorId: Int) { self => * > expected: String * > found: Int * - * This message wil be placed underneath the position given by the enclosing + * This message will be placed underneath the position given by the enclosing * `MessageContainer` */ def msg: String diff --git a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 65fafd092..4ee27c852 100644 --- a/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -184,7 +184,7 @@ object messages { val caseDef = s"case $pat$guard => $body" - hl"""|For each ${"case"} bound variable names have to be unique. In: + hl"""|For each ${"case"} bound variable names have to be unique. In: | |$caseDef | @@ -194,12 +194,14 @@ object messages { case class MissingIdent(tree: untpd.Ident, treeKind: String, name: String)(implicit ctx: Context) extends Message(6) { - val kind = "Missing Identifier" + val kind = "Unbound Identifier" val msg = em"not found: $treeKind$name" val explanation = { - hl"""|An identifier for `$treeKind$name` is missing. This means that something - |has either been misspelt or you're forgetting an import""" + hl"""|The identifier for `$treeKind$name` is not bound, that is, + |no declaration for this identifier can be found. + |That can happen for instance if $name or its declaration has either been + |misspelt, or if you're forgetting an import""" } } @@ -768,4 +770,23 @@ object messages { | - null |""" } + + case class PatternMatchExhaustivity(uncovered: String)(implicit ctx: Context) + extends Message(29) { + val kind = "Pattern Match Exhaustivity" + val msg = + hl"""|match may not be exhaustive. + | + |It would fail on: $uncovered""" + + + val explanation = "" + } + + case class MatchCaseUnreachable()(implicit ctx: Context) + extends Message(30) { + val kind = s"""Match ${hl"case"} Unreachable""" + val msg = "unreachable code" + val explanation = "" + } } diff --git a/src/dotty/tools/dotc/transform/patmat/Space.scala b/src/dotty/tools/dotc/transform/patmat/Space.scala index 830d0f938..8d926fcf0 100644 --- a/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -12,6 +12,7 @@ import core.Symbols._ import core.StdNames._ import core.NameOps._ import core.Constants._ +import reporting.diagnostic.messages._ /** Space logic for checking exhaustivity and unreachability of pattern matching * @@ -586,13 +587,8 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic { val patternSpace = cases.map(x => project(x.pat)).reduce((a, b) => Or(List(a, b))) val uncovered = simplify(minus(Typ(selTyp, true), patternSpace)) - if (uncovered != Empty) { - ctx.warning( - "match may not be exhaustive.\n" + - s"It would fail on the following input: " + - show(uncovered), _match.pos - ) - } + if (uncovered != Empty) + ctx.warning(PatternMatchExhaustivity(show(uncovered)), _match.pos) } def checkRedundancy(_match: Match): Unit = { @@ -612,7 +608,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic { val curr = project(cases(i).pat) if (isSubspace(curr, prevs)) { - ctx.warning("unreachable code", cases(i).body.pos) + ctx.warning(MatchCaseUnreachable(), cases(i).body.pos) } } } diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 9da0e2edc..dd7326fae 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -568,25 +568,14 @@ class Namer { typer: Typer => val cls = typedAheadAnnotation(annotTree) val ann = Annotation.deferred(cls, implicit ctx => typedAnnotation(annotTree)) denot.addAnnotation(ann) - if (cls == defn.InlineAnnot) { - hasInlineAnnot = true - addInlineInfo(denot, original) - } - } - if (!hasInlineAnnot && denot.is(InlineMethod)) { - // create a @inline annotation. Currently, the inlining trigger - // is really the annotation, not the flag. This is done so that - // we can still compile inline methods from Scala2x. Once we stop - // being compatible with Scala2 we should revise the logic to - // be based on the flag. Then creating a separate annotation becomes unnecessary. - denot.addAnnotation(Annotation(defn.InlineAnnot)) - addInlineInfo(denot, original) + if (cls == defn.InlineAnnot && denot.is(Method, butNot = Accessor)) + denot.setFlag(Inline) } case _ => } - private def addInlineInfo(denot: SymDenotation, original: untpd.Tree) = original match { - case original: untpd.DefDef => + private def addInlineInfo(denot: SymDenotation) = original match { + case original: untpd.DefDef if denot.isInlineMethod => Inliner.registerInlineInfo( denot, implicit ctx => typedAheadExpr(original).asInstanceOf[tpd.DefDef].rhs @@ -599,6 +588,7 @@ class Namer { typer: Typer => */ def completeInCreationContext(denot: SymDenotation): Unit = { addAnnotations(denot) + addInlineInfo(denot) denot.info = typeSig(denot.symbol) Checking.checkWellFormed(denot.symbol) } diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala index 95f0c5614..a93262314 100644 --- a/src/dotty/tools/dotc/typer/Typer.scala +++ b/src/dotty/tools/dotc/typer/Typer.scala @@ -1142,7 +1142,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit } val vdef1 = assignType(cpy.ValDef(vdef)(name, tpt1, rhs1), sym) if (sym.is(Inline, butNot = DeferredOrParamAccessor)) - checkInlineConformant(rhs1, "right-hand side of inline value") + checkInlineConformant(rhs1, em"right-hand side of inline $sym") patchIfLazy(vdef1) vdef1 } @@ -1176,8 +1176,7 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit val rhs1 = typedExpr(ddef.rhs, tpt1.tpe)(rhsCtx) // Overwrite inline body to make sure it is not evaluated twice - if (sym.hasAnnotation(defn.InlineAnnot)) - Inliner.registerInlineInfo(sym, _ => rhs1) + if (sym.isInlineMethod) Inliner.registerInlineInfo(sym, _ => rhs1) if (sym.isAnonymousFunction) { // If we define an anonymous function, make sure the return type does not diff --git a/test/dotty/tools/dotc/reporting/TestReporter.scala b/test/dotty/tools/dotc/reporting/TestReporter.scala new file mode 100644 index 000000000..70d18d031 --- /dev/null +++ b/test/dotty/tools/dotc/reporting/TestReporter.scala @@ -0,0 +1,52 @@ +package dotty.tools +package dotc +package reporting + +import scala.collection.mutable +import util.SourcePosition +import core.Contexts._ +import Reporter._ +import java.io.PrintWriter +import scala.reflect.internal.util._ +import diagnostic.{ Message, MessageContainer, NoExplanation } +import diagnostic.messages._ + +class TestReporter(writer: PrintWriter) extends Reporter +with UniqueMessagePositions with HideNonSensicalMessages { + + import MessageContainer._ + + /** maximal number of error messages to be printed */ + protected def ErrorLimit = 100 + + def printPos(pos: SourcePosition): Unit = + if (pos.exists) { + if (pos.outer.exists) { + writer.println(s"\ninlined at ${pos.outer}:\n") + printPos(pos.outer) + } + } + + /** Prints the message with the given position indication. */ + def printMessageAndPos(msg: String, pos: SourcePosition)(implicit ctx: Context): Unit = { + val posStr = s"${pos.line + 1}: " + writer.println(posStr + msg) + printPos(pos) + } + + override def doReport(m: MessageContainer)(implicit ctx: Context): Unit = { + // Here we add extra information that we should know about the error message + val extra = m.contained match { + case pm: PatternMatchExhaustivity => s": ${pm.uncovered}" + case _ => "" + } + + m match { + case m: Error => + printMessageAndPos(m.contained.kind + extra, m.pos) + case w: Warning => + printMessageAndPos(w.contained.kind + extra, w.pos) + case _ => + } + } +} diff --git a/test/test/transform/PatmatExhaustivityTest.scala b/test/test/transform/PatmatExhaustivityTest.scala new file mode 100644 index 000000000..c77ba501f --- /dev/null +++ b/test/test/transform/PatmatExhaustivityTest.scala @@ -0,0 +1,90 @@ +package test.transform + +import java.io._ + +import scala.io.Source._ +import scala.reflect.io.Directory +import org.junit.Test +import dotty.tools.dotc.Main +import dotty.tools.dotc.reporting.TestReporter + +class PatmatExhaustivityTest { + val testsDir = "./tests/patmat" + // stop-after: patmatexhaust-huge.scala crash compiler + val options = List("-color:never", "-Ystop-after:splitter", "-Ycheck-all-patmat") + + private def compileFile(file: File) = { + val stringBuffer = new StringWriter() + val reporter = new TestReporter(new PrintWriter(stringBuffer)) + + try { + Main.process((file.getPath::options).toArray, reporter, null) + } catch { + case e: Throwable => + println(s"Compile $file exception:") + e.printStackTrace() + } + + val actual = stringBuffer.toString.trim + val checkFilePath = file.getAbsolutePath.stripSuffix(".scala") + ".check" + val checkContent = + if (new File(checkFilePath).exists) + fromFile(checkFilePath).getLines.mkString("\n").trim + else "" + + (file, checkContent, actual) + } + + /** A single test with multiple files grouped in a folder */ + private def compileDir(file: File) = { + val stringBuffer = new StringWriter() + val reporter = new TestReporter(new PrintWriter(stringBuffer)) + + val files = Directory(file.getPath).list.toList + .filter(f => f.extension == "scala" || f.extension == "java" ) + .map(_.jfile.getPath) + + try { + Main.process((options ++ files).toArray, reporter, null) + } catch { + case e: Throwable => + println(s"Compile $file exception:") + e.printStackTrace() + } + + val actual = stringBuffer.toString.trim + val checkFilePath = file.getPath + File.separator + "expected.check" + val checkContent = + if (new File(checkFilePath).exists) + fromFile(checkFilePath).getLines.mkString("\n").trim + else "" + + (file, checkContent, actual) + } + + @Test def patmatExhaustivity: Unit = { + val res = Directory(testsDir).list.toList + .filter(f => f.extension == "scala" || f.isDirectory) + .map { f => + if (f.isDirectory) + compileDir(f.jfile) + else + compileFile(f.jfile) + } + + val failed = res.filter { case (_, expected, actual) => expected != actual } + val ignored = Directory(testsDir).list.toList.filter(_.extension == "ignore") + + failed.foreach { case (file, expected, actual) => + println(s"\n----------------- incorrect output for $file --------------\n" + + s"Expected:\n---------\n$expected\n\nActual:\n-------\n$actual\n" + ) + } + + val msg = s"Total: ${res.length + ignored.length}, Failed: ${failed.length}, Ignored: ${ignored.length}" + + assert(failed.length == 0, msg) + + println(msg) + } +} diff --git a/tests/neg/i1672.scala b/tests/neg/i1672.scala new file mode 100644 index 000000000..cbcc5bfb7 --- /dev/null +++ b/tests/neg/i1672.scala @@ -0,0 +1,7 @@ + +class Test { + implicit def compareComparables[T](x: T)(implicit ord: Ordering[T]) = // error: result type of implicit definition needs to be given explicitly + new ord.Ops(x) + class Bippy { def compare(y: Bippy) = util Random } + () < () // error: value `<` is not a member of Unit +} diff --git a/tests/patmat/NonAbstractSealed.check b/tests/patmat/NonAbstractSealed.check index 9224ee370..5ce80f81b 100644 --- a/tests/patmat/NonAbstractSealed.check +++ b/tests/patmat/NonAbstractSealed.check @@ -1,5 +1 @@ -./tests/patmat/NonAbstractSealed.scala:6: warning: match may not be exhaustive. -It would fail on the following input: _: A - (null: A) match { - ^ -one warning found
\ No newline at end of file +6: Pattern Match Exhaustivity: _: A diff --git a/tests/patmat/enum/expected.check b/tests/patmat/enum/expected.check index b3dafa8bd..296cf8bb2 100644 --- a/tests/patmat/enum/expected.check +++ b/tests/patmat/enum/expected.check @@ -1,9 +1,2 @@ -./tests/patmat/enum/patmat-enum.scala:4: warning: match may not be exhaustive. -It would fail on the following input: SATURDAY, FRIDAY, THURSDAY, SUNDAY - day match { - ^ -./tests/patmat/enum/patmat-enum.scala:15: warning: match may not be exhaustive. -It would fail on the following input: SATURDAY, FRIDAY, THURSDAY - day match { - ^ -two warnings found
\ No newline at end of file +4: Pattern Match Exhaustivity: SATURDAY, FRIDAY, THURSDAY, SUNDAY +15: Pattern Match Exhaustivity: SATURDAY, FRIDAY, THURSDAY diff --git a/tests/patmat/exhausting.check b/tests/patmat/exhausting.check index 790b12334..b8d1d8408 100644 --- a/tests/patmat/exhausting.check +++ b/tests/patmat/exhausting.check @@ -1,25 +1,6 @@ -./tests/patmat/exhausting.scala:21: warning: match may not be exhaustive. -It would fail on the following input: List(_), List(_, _, _) - def fail1[T](xs: List[T]) = xs match { - ^ -./tests/patmat/exhausting.scala:27: warning: match may not be exhaustive. -It would fail on the following input: Nil - def fail2[T](xs: List[T]) = xs match { - ^ -./tests/patmat/exhausting.scala:32: warning: match may not be exhaustive. -It would fail on the following input: List(_, _) - def fail3a(xs: List[Int]) = xs match { - ^ -./tests/patmat/exhausting.scala:39: warning: match may not be exhaustive. -It would fail on the following input: Bar3 - def fail3[T](x: Foo[T]) = x match { - ^ -./tests/patmat/exhausting.scala:44: warning: match may not be exhaustive. -It would fail on the following input: (Bar2, Bar2) - def fail4[T <: AnyRef](xx: (Foo[T], Foo[T])) = xx match { - ^ -./tests/patmat/exhausting.scala:53: warning: match may not be exhaustive. -It would fail on the following input: (Bar2, Bar2), (Bar2, Bar1), (Bar1, Bar3), (Bar1, Bar2) - def fail5[T](xx: (Foo[T], Foo[T])) = xx match { - ^ -6 warnings found +21: Pattern Match Exhaustivity: List(_), List(_, _, _) +27: Pattern Match Exhaustivity: Nil +32: Pattern Match Exhaustivity: List(_, _) +39: Pattern Match Exhaustivity: Bar3 +44: Pattern Match Exhaustivity: (Bar2, Bar2) +53: Pattern Match Exhaustivity: (Bar2, Bar2), (Bar2, Bar1), (Bar1, Bar3), (Bar1, Bar2) diff --git a/tests/patmat/gadt.check b/tests/patmat/gadt.check index f2154fa60..71860e52a 100644 --- a/tests/patmat/gadt.check +++ b/tests/patmat/gadt.check @@ -1,17 +1,4 @@ -./tests/patmat/gadt.scala:13: warning: match may not be exhaustive. -It would fail on the following input: IntLit(_) - def foo1b(x: Expr[Int]) = x match { - ^ -./tests/patmat/gadt.scala:22: warning: match may not be exhaustive. -It would fail on the following input: Or(_, _) - def foo2b(x: Expr[Boolean]) = x match { - ^ -./tests/patmat/gadt.scala:45: warning: match may not be exhaustive. -It would fail on the following input: BooleanLit(_), IntLit(_) - def foo4b(x: Expr[_]) = x match { - ^ -./tests/patmat/gadt.scala:55: warning: match may not be exhaustive. -It would fail on the following input: Sum(_, _) - def foo5b[T <: Int](x: Expr[T]) = x match { - ^ -four warnings found
\ No newline at end of file +13: Pattern Match Exhaustivity: IntLit(_) +22: Pattern Match Exhaustivity: Or(_, _) +45: Pattern Match Exhaustivity: BooleanLit(_), IntLit(_) +55: Pattern Match Exhaustivity: Sum(_, _) diff --git a/tests/patmat/i947.check b/tests/patmat/i947.check index 5cce559c4..024161675 100644 --- a/tests/patmat/i947.check +++ b/tests/patmat/i947.check @@ -1,4 +1 @@ -./tests/patmat/i947.scala:10: warning: unreachable code - case ys: List[d18383] => false - ^ -one warning found
\ No newline at end of file +10: Match case Unreachable diff --git a/tests/patmat/patmat-adt.check b/tests/patmat/patmat-adt.check index f4e1ce369..4adcdc49c 100644 --- a/tests/patmat/patmat-adt.check +++ b/tests/patmat/patmat-adt.check @@ -1,21 +1,5 @@ -./tests/patmat/patmat-adt.scala:7: warning: match may not be exhaustive. -It would fail on the following input: Bad(Good(_)), Good(Bad(_)) - def foo1a(x: Odd) = x match { // warning: Good(_: Bad), Bad(_: Good) - ^ -./tests/patmat/patmat-adt.scala:19: warning: match may not be exhaustive. -It would fail on the following input: Some(_) - def foo2(x: Option[Int]) = x match { // warning: Some(_: Int) - ^ -./tests/patmat/patmat-adt.scala:24: warning: match may not be exhaustive. -It would fail on the following input: (None, Some(_)), (_, Some(_)) - def foo3a[T](x: Option[T]) = (x, x) match { // warning: (Some(_), Some(_)), (None, Some(_)) - ^ -./tests/patmat/patmat-adt.scala:29: warning: match may not be exhaustive. -It would fail on the following input: (None, None), (Some(_), Some(_)) - def foo3b[T](x: Option[T]) = (x, x) match { // warning: (Some(_), Some(_)), (None, None) - ^ -./tests/patmat/patmat-adt.scala:50: warning: match may not be exhaustive. -It would fail on the following input: LetL(BooleanLit), LetL(IntLit) - def foo5(tree: Tree) : Any = tree match { - ^ -5 warnings found
\ No newline at end of file +7: Pattern Match Exhaustivity: Bad(Good(_)), Good(Bad(_)) +19: Pattern Match Exhaustivity: Some(_) +24: Pattern Match Exhaustivity: (None, Some(_)), (_, Some(_)) +29: Pattern Match Exhaustivity: (None, None), (Some(_), Some(_)) +50: Pattern Match Exhaustivity: LetL(BooleanLit), LetL(IntLit) diff --git a/tests/patmat/patmat-indent.check b/tests/patmat/patmat-indent.check index 3a76e0a95..79845ebcf 100644 --- a/tests/patmat/patmat-indent.check +++ b/tests/patmat/patmat-indent.check @@ -1,13 +1,3 @@ -./tests/patmat/patmat-indent.scala:9: warning: match may not be exhaustive. -It would fail on the following input: Nil - def foo1a[T](l: List[T]) = l match { - ^ -./tests/patmat/patmat-indent.scala:23: warning: match may not be exhaustive. -It would fail on the following input: _: Boolean - def foo2(b: Boolean) = b match { - ^ -./tests/patmat/patmat-indent.scala:27: warning: match may not be exhaustive. -It would fail on the following input: _: Int - def foo3(x: Int) = x match { - ^ -three warnings found
\ No newline at end of file +9: Pattern Match Exhaustivity: Nil +23: Pattern Match Exhaustivity: _: Boolean +27: Pattern Match Exhaustivity: _: Int diff --git a/tests/patmat/patmat-ortype.check b/tests/patmat/patmat-ortype.check index 2291da251..0bd790437 100644 --- a/tests/patmat/patmat-ortype.check +++ b/tests/patmat/patmat-ortype.check @@ -1,13 +1,3 @@ -./tests/patmat/patmat-ortype.scala:8: warning: match may not be exhaustive. -It would fail on the following input: _: String - def foo2a(x: Int | Double | String) = x match { // _: String not matched - ^ -./tests/patmat/patmat-ortype.scala:18: warning: match may not be exhaustive. -It would fail on the following input: Some(_: String), None - def foo3(x: Option[Int | Double | String]) = x match { // warning: None, Some(_: String) not matched - ^ -./tests/patmat/patmat-ortype.scala:36: warning: match may not be exhaustive. -It would fail on the following input: Some(_: String) - def foo5b(x: Option[Int | Double | String]) = x match { // warning: Some(_: String) not matched - ^ -three warnings found
\ No newline at end of file +8: Pattern Match Exhaustivity: _: String +18: Pattern Match Exhaustivity: Some(_: String), None +36: Pattern Match Exhaustivity: Some(_: String) diff --git a/tests/patmat/patmatexhaust-huge.check b/tests/patmat/patmatexhaust-huge.check index 06cac90bd..f622622de 100644 --- a/tests/patmat/patmatexhaust-huge.check +++ b/tests/patmat/patmatexhaust-huge.check @@ -1,5 +1 @@ -./tests/patmat/patmatexhaust-huge.scala:404: warning: match may not be exhaustive. -It would fail on the following input: C397, C392 - def f(c: C): Int = c match { - ^ -one warning found
\ No newline at end of file +404: Pattern Match Exhaustivity: C397, C392 diff --git a/tests/patmat/patmatexhaust.check b/tests/patmat/patmatexhaust.check index ef2b578d6..3de93cfdb 100644 --- a/tests/patmat/patmatexhaust.check +++ b/tests/patmat/patmatexhaust.check @@ -1,33 +1,8 @@ -./tests/patmat/patmatexhaust.scala:7: warning: match may not be exhaustive. -It would fail on the following input: Baz - def ma1(x:Foo) = x match { - ^ -./tests/patmat/patmatexhaust.scala:11: warning: match may not be exhaustive. -It would fail on the following input: Bar(_) - def ma2(x:Foo) = x match { - ^ -./tests/patmat/patmatexhaust.scala:23: warning: match may not be exhaustive. -It would fail on the following input: (Qult(), Qult()), (Kult(_), Kult(_)) - def ma3(x:Mult) = (x,x) match { // not exhaustive - ^ -./tests/patmat/patmatexhaust.scala:49: warning: match may not be exhaustive. -It would fail on the following input: _: Gp - def ma4(x:Deep) = x match { // missing cases: Gu, Gp which is not abstract so must be included - ^ -./tests/patmat/patmatexhaust.scala:75: warning: match may not be exhaustive. -It would fail on the following input: _: B - def ma9(x: B) = x match { - ^ -./tests/patmat/patmatexhaust.scala:100: warning: match may not be exhaustive. -It would fail on the following input: _: C1 - def ma10(x: C) = x match { // not exhaustive: C1 is not sealed. - ^ -./tests/patmat/patmatexhaust.scala:114: warning: match may not be exhaustive. -It would fail on the following input: D2(), D1 - def ma10(x: C) = x match { // not exhaustive: C1 has subclasses. - ^ -./tests/patmat/patmatexhaust.scala:126: warning: match may not be exhaustive. -It would fail on the following input: _: C1 - def ma10(x: C) = x match { // not exhaustive: C1 is not abstract. - ^ -8 warnings found
\ No newline at end of file +7: Pattern Match Exhaustivity: Baz +11: Pattern Match Exhaustivity: Bar(_) +23: Pattern Match Exhaustivity: (Qult(), Qult()), (Kult(_), Kult(_)) +49: Pattern Match Exhaustivity: _: Gp +75: Pattern Match Exhaustivity: _: B +100: Pattern Match Exhaustivity: _: C1 +114: Pattern Match Exhaustivity: D2(), D1 +126: Pattern Match Exhaustivity: _: C1 diff --git a/tests/patmat/sealed-java-enums.check b/tests/patmat/sealed-java-enums.check index ed93d3d40..86e73f0da 100644 --- a/tests/patmat/sealed-java-enums.check +++ b/tests/patmat/sealed-java-enums.check @@ -1,5 +1 @@ -./tests/patmat/sealed-java-enums.scala:5: warning: match may not be exhaustive. -It would fail on the following input: TERMINATED, TIMED_WAITING, BLOCKED - def f(state: State) = state match { - ^ -one warning found +5: Pattern Match Exhaustivity: TERMINATED, TIMED_WAITING, BLOCKED diff --git a/tests/patmat/t2442/expected.check b/tests/patmat/t2442/expected.check index 33110ce43..7bbcb4c2d 100644 --- a/tests/patmat/t2442/expected.check +++ b/tests/patmat/t2442/expected.check @@ -1,9 +1,2 @@ -./tests/patmat/t2442/t2442.scala:4: warning: match may not be exhaustive. -It would fail on the following input: THREE - def f(e: MyEnum) = e match { - ^ -./tests/patmat/t2442/t2442.scala:11: warning: match may not be exhaustive. -It would fail on the following input: BLUE - def g(e: MySecondEnum) = e match { - ^ -two warnings found +4: Pattern Match Exhaustivity: THREE +11: Pattern Match Exhaustivity: BLUE diff --git a/tests/patmat/t3098/expected.check b/tests/patmat/t3098/expected.check index 331904111..3198aa2ef 100644 --- a/tests/patmat/t3098/expected.check +++ b/tests/patmat/t3098/expected.check @@ -1,5 +1 @@ -./tests/patmat/t3098/b.scala:3: warning: match may not be exhaustive. -It would fail on the following input: _: C - def f = (null: T) match { - ^ -one warning found
\ No newline at end of file +3: Pattern Match Exhaustivity: _: C diff --git a/tests/patmat/t3111.check b/tests/patmat/t3111.check index 46ff0a6a9..be1e7d808 100644 --- a/tests/patmat/t3111.check +++ b/tests/patmat/t3111.check @@ -1,8 +1,2 @@ -./tests/patmat/t3111.scala:4: warning: match may not be exhaustive. -It would fail on the following input: false - bool match { - ^ -./tests/patmat/t3111.scala:11: warning: unreachable code - case _ => "cats and dogs living together... mass hysteria!" - ^ -two warnings found
\ No newline at end of file +4: Pattern Match Exhaustivity: false +11: Match case Unreachable diff --git a/tests/patmat/t3163.check b/tests/patmat/t3163.check index 3da94e2c2..51c58f9e3 100644 --- a/tests/patmat/t3163.check +++ b/tests/patmat/t3163.check @@ -1,5 +1 @@ -./tests/patmat/t3163.scala:2: warning: match may not be exhaustive. -It would fail on the following input: _: AnyVal - def foo(x : AnyVal) = x match {case b : Boolean => "It's a bool"} - ^ -one warning found
\ No newline at end of file +2: Pattern Match Exhaustivity: _: AnyVal diff --git a/tests/patmat/t3683a.check b/tests/patmat/t3683a.check index df5e691c6..fdcafc596 100644 --- a/tests/patmat/t3683a.check +++ b/tests/patmat/t3683a.check @@ -1,5 +1 @@ -./tests/patmat/t3683a.scala:14: warning: match may not be exhaustive. -It would fail on the following input: XX() - w match { - ^ -one warning found +14: Pattern Match Exhaustivity: XX() diff --git a/tests/patmat/t4408.check b/tests/patmat/t4408.check index 53bfe1c2c..2bd8b583f 100644 --- a/tests/patmat/t4408.check +++ b/tests/patmat/t4408.check @@ -1,5 +1 @@ -./tests/patmat/t4408.scala:2: warning: match may not be exhaustive. -It would fail on the following input: List(_, _, _) - def printList(in: List[String]): Unit = in match { - ^ -one warning found
\ No newline at end of file +2: Pattern Match Exhaustivity: List(_, _, _) diff --git a/tests/patmat/t4526.check b/tests/patmat/t4526.check index b577cbc0c..802d0fe22 100644 --- a/tests/patmat/t4526.check +++ b/tests/patmat/t4526.check @@ -1,13 +1,3 @@ -./tests/patmat/t4526.scala:2: warning: match may not be exhaustive. -It would fail on the following input: _: Int - def foo(a: Int) = a match { - ^ -./tests/patmat/t4526.scala:7: warning: match may not be exhaustive. -It would fail on the following input: (_, _) - def bar(a: (Int, Int)) = a match { - ^ -./tests/patmat/t4526.scala:12: warning: match may not be exhaustive. -It would fail on the following input: (false, false), (true, true) - def baz(a: (Boolean, Boolean)) = a match { - ^ -three warnings found
\ No newline at end of file +2: Pattern Match Exhaustivity: _: Int +7: Pattern Match Exhaustivity: (_, _) +12: Pattern Match Exhaustivity: (false, false), (true, true) diff --git a/tests/patmat/t4691.check b/tests/patmat/t4691.check index 4d2c24506..5fbcb267a 100644 --- a/tests/patmat/t4691.check +++ b/tests/patmat/t4691.check @@ -1,5 +1 @@ -./tests/patmat/t4691.scala:15: warning: match may not be exhaustive. -It would fail on the following input: NodeType2(_) - def test (x: Node) = x match { - ^ -one warning found
\ No newline at end of file +15: Pattern Match Exhaustivity: NodeType2(_) diff --git a/tests/patmat/t4691_exhaust_extractor.check b/tests/patmat/t4691_exhaust_extractor.check index e7d1e17f9..3122f85c8 100644 --- a/tests/patmat/t4691_exhaust_extractor.check +++ b/tests/patmat/t4691_exhaust_extractor.check @@ -1,13 +1,3 @@ -./tests/patmat/t4691_exhaust_extractor.scala:17: warning: match may not be exhaustive. -It would fail on the following input: _: Bar3 - def f1(x: Foo) = x match { - ^ -./tests/patmat/t4691_exhaust_extractor.scala:23: warning: match may not be exhaustive. -It would fail on the following input: _: Bar3 - def f2(x: Foo) = x match { - ^ -./tests/patmat/t4691_exhaust_extractor.scala:29: warning: match may not be exhaustive. -It would fail on the following input: _: Bar3 - def f3(x: Foo) = x match { - ^ -three warnings found +17: Pattern Match Exhaustivity: _: Bar3 +23: Pattern Match Exhaustivity: _: Bar3 +29: Pattern Match Exhaustivity: _: Bar3 diff --git a/tests/patmat/t5440.check b/tests/patmat/t5440.check index 0780d6529..511fcc6b4 100644 --- a/tests/patmat/t5440.check +++ b/tests/patmat/t5440.check @@ -1,5 +1 @@ -./tests/patmat/t5440.scala:2: warning: match may not be exhaustive. -It would fail on the following input: (Nil, List(_)), (List(_), Nil) - def merge(list1: List[Long], list2: List[Long]): Boolean = (list1, list2) match { - ^ -one warning found +2: Pattern Match Exhaustivity: (Nil, List(_)), (List(_), Nil) diff --git a/tests/patmat/t6420.check b/tests/patmat/t6420.check index c62b33d18..73acf1454 100644 --- a/tests/patmat/t6420.check +++ b/tests/patmat/t6420.check @@ -1,5 +1 @@ -./tests/patmat/t6420.scala:5: warning: match may not be exhaustive. -It would fail on the following input: (Nil, _), (List(_, _), _), (Nil, Nil), (Nil, List(_, _)), (List(_, _), Nil), (List(_, _), List(_, _)), (_, Nil), (_, List(_, _)) - def foo(x: List[Boolean], y: List[Boolean]) = (x,y) match { - ^ -one warning found
\ No newline at end of file +5: Pattern Match Exhaustivity: (Nil, _), (List(_, _), _), (Nil, Nil), (Nil, List(_, _)), (List(_, _), Nil), (List(_, _), List(_, _)), (_, Nil), (_, List(_, _)) diff --git a/tests/patmat/t6582_exhaust_big.check b/tests/patmat/t6582_exhaust_big.check index c244e5ba5..3721edc70 100644 --- a/tests/patmat/t6582_exhaust_big.check +++ b/tests/patmat/t6582_exhaust_big.check @@ -1,5 +1 @@ -./tests/patmat/t6582_exhaust_big.scala:27: warning: match may not be exhaustive. -It would fail on the following input: Z.Z11() - def foo(z: Z) = z match { - ^ -one warning found +27: Pattern Match Exhaustivity: Z.Z11() diff --git a/tests/patmat/t7020.check b/tests/patmat/t7020.check index c091535ae..a44384946 100644 --- a/tests/patmat/t7020.check +++ b/tests/patmat/t7020.check @@ -1,17 +1,4 @@ -./tests/patmat/t7020.scala:3: warning: match may not be exhaustive. -It would fail on the following input: List(_, _) - List(5) match { - ^ -./tests/patmat/t7020.scala:10: warning: match may not be exhaustive. -It would fail on the following input: List(_, _) - List(5) match { - ^ -./tests/patmat/t7020.scala:17: warning: match may not be exhaustive. -It would fail on the following input: List(_, _) - List(5) match { - ^ -./tests/patmat/t7020.scala:24: warning: match may not be exhaustive. -It would fail on the following input: List(_, _) - List(5) match { - ^ -four warnings found +3: Pattern Match Exhaustivity: List(_, _) +10: Pattern Match Exhaustivity: List(_, _) +17: Pattern Match Exhaustivity: List(_, _) +24: Pattern Match Exhaustivity: List(_, _) diff --git a/tests/patmat/t7285.check b/tests/patmat/t7285.check index 703706cdc..1c2841920 100644 --- a/tests/patmat/t7285.check +++ b/tests/patmat/t7285.check @@ -1,13 +1,3 @@ -./tests/patmat/t7285.scala:15: warning: match may not be exhaustive. -It would fail on the following input: (Up, Down) - (d1, d2) match { - ^ -./tests/patmat/t7285.scala:33: warning: match may not be exhaustive. -It would fail on the following input: Down - (d1) match { - ^ -./tests/patmat/t7285.scala:51: warning: match may not be exhaustive. -It would fail on the following input: (Base.Up, Base.Down) - (d1, d2) match { - ^ -three warnings found
\ No newline at end of file +15: Pattern Match Exhaustivity: (Up, Down) +33: Pattern Match Exhaustivity: Down +51: Pattern Match Exhaustivity: (Base.Up, Base.Down) diff --git a/tests/patmat/t7466.check b/tests/patmat/t7466.check index 8e575f6a2..35227484e 100644 --- a/tests/patmat/t7466.check +++ b/tests/patmat/t7466.check @@ -1,5 +1 @@ -./tests/patmat/t7466.scala:8: warning: match may not be exhaustive. -It would fail on the following input: (_, _) - (b1, b2) match { - ^ -one warning found
\ No newline at end of file +8: Pattern Match Exhaustivity: (_, _) diff --git a/tests/patmat/t7631.check b/tests/patmat/t7631.check index ede3703e2..78dc1ac36 100644 --- a/tests/patmat/t7631.check +++ b/tests/patmat/t7631.check @@ -1,5 +1 @@ -./tests/patmat/t7631.scala:8: warning: match may not be exhaustive. -It would fail on the following input: TestB() - val x = input match { - ^ -one warning found
\ No newline at end of file +8: Pattern Match Exhaustivity: TestB() diff --git a/tests/patmat/t7669.check b/tests/patmat/t7669.check index 2804dbf5c..a8a331424 100644 --- a/tests/patmat/t7669.check +++ b/tests/patmat/t7669.check @@ -1,5 +1 @@ -./tests/patmat/t7669.scala:10: warning: match may not be exhaustive. -It would fail on the following input: NotHandled(_) - def exhausto(expr: Expr): Unit = expr match { - ^ -one warning found
\ No newline at end of file +10: Pattern Match Exhaustivity: NotHandled(_) diff --git a/tests/patmat/t7746.check b/tests/patmat/t7746.check index be4c53570..cdba0449f 100644 --- a/tests/patmat/t7746.check +++ b/tests/patmat/t7746.check @@ -1,5 +1 @@ -./tests/patmat/t7746.scala:2: warning: match may not be exhaustive. -It would fail on the following input: Some(_), None - def f[T](x: Option[T]) = x match { - ^ -one warning found
\ No newline at end of file +2: Pattern Match Exhaustivity: Some(_), None diff --git a/tests/patmat/t8178.check b/tests/patmat/t8178.check index 963845f53..1bcae1c1f 100644 --- a/tests/patmat/t8178.check +++ b/tests/patmat/t8178.check @@ -1,13 +1,3 @@ -./tests/patmat/t8178.scala:6: warning: match may not be exhaustive. -It would fail on the following input: FailsChild2(_) - f match { - ^ -./tests/patmat/t8178.scala:14: warning: match may not be exhaustive. -It would fail on the following input: VarArgs1(_) - f match { - ^ -./tests/patmat/t8178.scala:27: warning: match may not be exhaustive. -It would fail on the following input: SeqArgs2(_) - f match { - ^ -three warnings found
\ No newline at end of file +6: Pattern Match Exhaustivity: FailsChild2(_) +14: Pattern Match Exhaustivity: VarArgs1(_) +27: Pattern Match Exhaustivity: SeqArgs2(_) diff --git a/tests/patmat/t8412.check b/tests/patmat/t8412.check index b82b33999..08ee2636d 100644 --- a/tests/patmat/t8412.check +++ b/tests/patmat/t8412.check @@ -1,5 +1 @@ -./tests/patmat/t8412.scala:7: warning: match may not be exhaustive. -It would fail on the following input: Lit(_) - tree match { - ^ -one warning found
\ No newline at end of file +7: Pattern Match Exhaustivity: Lit(_) diff --git a/tests/patmat/t8430.check b/tests/patmat/t8430.check index 4493062bf..d72de5237 100644 --- a/tests/patmat/t8430.check +++ b/tests/patmat/t8430.check @@ -1,5 +1 @@ -./tests/patmat/t8430.scala:15: warning: match may not be exhaustive. -It would fail on the following input: LetF, LetC, LetP, LetL(UnitLit), LetL(BooleanLit), LetL(IntLit) - def transform(tree: Tree) : Any = tree match { - ^ -one warning found
\ No newline at end of file +15: Pattern Match Exhaustivity: LetF, LetC, LetP, LetL(UnitLit), LetL(BooleanLit), LetL(IntLit) diff --git a/tests/patmat/t8511.check b/tests/patmat/t8511.check index df07d019a..6f63f1040 100644 --- a/tests/patmat/t8511.check +++ b/tests/patmat/t8511.check @@ -1,5 +1 @@ -./tests/patmat/t8511.scala:18: warning: match may not be exhaustive. -It would fail on the following input: Baz(), Bar(_) - private def logic(head: Expr): String = head match { - ^ -one warning found
\ No newline at end of file +18: Pattern Match Exhaustivity: Baz(), Bar(_) diff --git a/tests/patmat/t8700a/expected.check b/tests/patmat/t8700a/expected.check index 83f1c5a9e..c4774f824 100644 --- a/tests/patmat/t8700a/expected.check +++ b/tests/patmat/t8700a/expected.check @@ -1,9 +1,2 @@ -./tests/patmat/t8700a/Bar.scala:2: warning: match may not be exhaustive. -It would fail on the following input: B - def bar1(foo: Foo) = foo match { - ^ -./tests/patmat/t8700a/Bar.scala:6: warning: match may not be exhaustive. -It would fail on the following input: B - def bar2(foo: Baz) = foo match { - ^ -two warnings found +2: Pattern Match Exhaustivity: B +6: Pattern Match Exhaustivity: B diff --git a/tests/patmat/t9129.check b/tests/patmat/t9129.check index aa722a61a..3236bb049 100644 --- a/tests/patmat/t9129.check +++ b/tests/patmat/t9129.check @@ -1,5 +1 @@ -./tests/patmat/t9129.scala:21: warning: match may not be exhaustive. -It would fail on the following input: Two(B2, A2), Two(_, A2) - def foo(c: C): Unit = c match { - ^ -one warning found
\ No newline at end of file +21: Pattern Match Exhaustivity: Two(B2, A2), Two(_, A2) diff --git a/tests/patmat/t9232.check b/tests/patmat/t9232.check index c3957c0ff..36949147a 100644 --- a/tests/patmat/t9232.check +++ b/tests/patmat/t9232.check @@ -1,5 +1 @@ -./tests/patmat/t9232.scala:13: warning: match may not be exhaustive. -It would fail on the following input: Node2() - def transformTree(tree: Tree): Any = tree match { - ^ -one warning found +13: Pattern Match Exhaustivity: Node2() diff --git a/tests/patmat/t9289.check b/tests/patmat/t9289.check index 5240988e2..9a3b61e01 100644 --- a/tests/patmat/t9289.check +++ b/tests/patmat/t9289.check @@ -1,9 +1,2 @@ -./tests/patmat/t9289.scala:9: warning: match may not be exhaustive. -It would fail on the following input: module.LetR() - def patmat(tree: module.Tree) = tree match { - ^ -./tests/patmat/t9289.scala:20: warning: match may not be exhaustive. -It would fail on the following input: module.LetR() - def patmat(tree: module.Tree) = tree match { - ^ -two warnings found
\ No newline at end of file +9: Pattern Match Exhaustivity: module.LetR() +20: Pattern Match Exhaustivity: module.LetR() diff --git a/tests/patmat/t9351.check b/tests/patmat/t9351.check index 03b94c2c0..bce053c94 100644 --- a/tests/patmat/t9351.check +++ b/tests/patmat/t9351.check @@ -1,13 +1,3 @@ -./tests/patmat/t9351.scala:8: warning: match may not be exhaustive. -It would fail on the following input: _: A - a match { - ^ -./tests/patmat/t9351.scala:17: warning: match may not be exhaustive. -It would fail on the following input: (_, _), (_, None), (_, Some(_)) - (a, o) match { - ^ -./tests/patmat/t9351.scala:28: warning: match may not be exhaustive. -It would fail on the following input: (_, _) - (a, b) match { - ^ -three warnings found
\ No newline at end of file +8: Pattern Match Exhaustivity: _: A +17: Pattern Match Exhaustivity: (_, _), (_, None), (_, Some(_)) +28: Pattern Match Exhaustivity: (_, _) diff --git a/tests/patmat/t9398.check b/tests/patmat/t9398.check index 0efbf231d..279762d88 100644 --- a/tests/patmat/t9398.check +++ b/tests/patmat/t9398.check @@ -1,5 +1 @@ -./tests/patmat/t9398.scala:11: warning: match may not be exhaustive. -It would fail on the following input: CC(_, B2) - case CC(_, B) => () - ^ -one warning found +11: Pattern Match Exhaustivity: CC(_, B2) diff --git a/tests/patmat/t9573.check b/tests/patmat/t9573.check index 4ec379161..70c8e8014 100644 --- a/tests/patmat/t9573.check +++ b/tests/patmat/t9573.check @@ -1,5 +1 @@ -./tests/patmat/t9573.scala:9: warning: match may not be exhaustive. -It would fail on the following input: Horse(_) - x match { - ^ -one warning found
\ No newline at end of file +9: Pattern Match Exhaustivity: Horse(_) diff --git a/tests/patmat/t9657.check b/tests/patmat/t9657.check index d3e2ec73f..9b92bee60 100644 --- a/tests/patmat/t9657.check +++ b/tests/patmat/t9657.check @@ -1,17 +1,4 @@ -./tests/patmat/t9657.scala:29: warning: match may not be exhaustive. -It would fail on the following input: Bus(_) - def refuel2[P <: Petrol.type](vehicle: Vehicle {type A = P} ): Vehicle = vehicle match { - ^ -./tests/patmat/t9657.scala:38: warning: match may not be exhaustive. -It would fail on the following input: Bus(_) - def foo2(vehicle: Vehicle {type A <: Petrol.type} ): Vehicle = vehicle match { - ^ -./tests/patmat/t9657.scala:49: warning: match may not be exhaustive. -It would fail on the following input: Bus(_) - def bar2(vehicle: Vehicle {type A <: P} ): Vehicle = vehicle match { - ^ -./tests/patmat/t9657.scala:58: warning: match may not be exhaustive. -It would fail on the following input: Bus(_) - def qux2[P <: Petrol.type](vehicle: Vehicle {type A <: P} ): Vehicle = vehicle match { - ^ -four warnings found
\ No newline at end of file +29: Pattern Match Exhaustivity: Bus(_) +38: Pattern Match Exhaustivity: Bus(_) +49: Pattern Match Exhaustivity: Bus(_) +58: Pattern Match Exhaustivity: Bus(_) diff --git a/tests/patmat/t9672.check b/tests/patmat/t9672.check index 3284d1df1..41460e46f 100644 --- a/tests/patmat/t9672.check +++ b/tests/patmat/t9672.check @@ -1,5 +1 @@ -./tests/patmat/t9672.scala:22: warning: match may not be exhaustive. -It would fail on the following input: SimpleExpr.IntExpr(_) - def func(expr: Expr) = expr match { - ^ -one warning found
\ No newline at end of file +22: Pattern Match Exhaustivity: SimpleExpr.IntExpr(_) diff --git a/tests/patmat/t9677.check b/tests/patmat/t9677.check index f1e1817cb..3d9e1c4e2 100644 --- a/tests/patmat/t9677.check +++ b/tests/patmat/t9677.check @@ -1,4 +1 @@ -./tests/patmat/t9677.scala:20: warning: unreachable code - case path: A => println("Not root") - ^ -one warning found
\ No newline at end of file +20: Match case Unreachable diff --git a/tests/patmat/t9779.check b/tests/patmat/t9779.check index 0e0d8d5f4..a7d6cfbea 100644 --- a/tests/patmat/t9779.check +++ b/tests/patmat/t9779.check @@ -1,5 +1 @@ -./tests/patmat/t9779.scala:10: warning: match may not be exhaustive. -It would fail on the following input: _: a.Elem - private def toLuaValue(eX: a.Elem[_]): String = eX match { - ^ -one warning found
\ No newline at end of file +10: Pattern Match Exhaustivity: _: a.Elem diff --git a/tests/patmat/virtpatmat_apply.check b/tests/patmat/virtpatmat_apply.check index d10d82165..aa4d0b884 100644 --- a/tests/patmat/virtpatmat_apply.check +++ b/tests/patmat/virtpatmat_apply.check @@ -1,5 +1 @@ -./tests/patmat/virtpatmat_apply.scala:2: warning: match may not be exhaustive. -It would fail on the following input: List(_) - List(1, 2, 3) match { - ^ -one warning found
\ No newline at end of file +2: Pattern Match Exhaustivity: List(_) diff --git a/tests/patmat/virtpatmat_reach_sealed_unsealed.check b/tests/patmat/virtpatmat_reach_sealed_unsealed.check index ef5ec1a00..6b0ea7f8e 100644 --- a/tests/patmat/virtpatmat_reach_sealed_unsealed.check +++ b/tests/patmat/virtpatmat_reach_sealed_unsealed.check @@ -1,11 +1,3 @@ -./tests/patmat/virtpatmat_reach_sealed_unsealed.scala:16: warning: match may not be exhaustive. -It would fail on the following input: false - (true: Boolean) match { case true => } // not exhaustive, but reachable - ^ -./tests/patmat/virtpatmat_reach_sealed_unsealed.scala:18: warning: unreachable code - (true: Boolean) match { case true => case false => case _ => } // exhaustive, last case is unreachable - ^ -./tests/patmat/virtpatmat_reach_sealed_unsealed.scala:19: warning: unreachable code - (true: Boolean) match { case true => case false => case _: Boolean => } // exhaustive, last case is unreachable - ^ -three warnings found +16: Pattern Match Exhaustivity: false +18: Match case Unreachable +19: Match case Unreachable |