From d0af55ce1ffb9d77e6a604edb41cda2b955e9f02 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 8 Oct 2013 21:20:23 +0200 Subject: SI-7895 Avoid cascade of "symbol not found" in pattern matches If we can't type check the `Foo` in `case Foo(a, b) => (a, b)`, we should enter error symbols for `a` and `b` to avoid further errors being reported in the case body. --- test/files/neg/t0418.check | 5 +---- test/files/neg/t418.check | 5 +---- test/files/neg/t545.check | 5 +---- test/files/neg/t5903a.check | 5 +---- test/files/neg/t5903b.check | 5 +---- test/files/neg/t5903c.check | 5 +---- test/files/neg/t5903d.check | 5 +---- test/files/neg/t7895.check | 4 ++++ test/files/neg/t7895.scala | 6 ++++++ test/files/neg/t997.check | 5 +---- 10 files changed, 18 insertions(+), 32 deletions(-) create mode 100644 test/files/neg/t7895.check create mode 100644 test/files/neg/t7895.scala (limited to 'test/files/neg') diff --git a/test/files/neg/t0418.check b/test/files/neg/t0418.check index 4e9ad2f9ae..b95f8e4e1b 100644 --- a/test/files/neg/t0418.check +++ b/test/files/neg/t0418.check @@ -1,7 +1,4 @@ t0418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t0418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t418.check b/test/files/neg/t418.check index 1489547823..1b99717b82 100644 --- a/test/files/neg/t418.check +++ b/test/files/neg/t418.check @@ -1,7 +1,4 @@ t418.scala:2: error: not found: value Foo12340771 null match { case Foo12340771.Bar(x) => x } ^ -t418.scala:2: error: not found: value x - null match { case Foo12340771.Bar(x) => x } - ^ -two errors found +one error found diff --git a/test/files/neg/t545.check b/test/files/neg/t545.check index 8ebbf9bdf6..aae575fa96 100644 --- a/test/files/neg/t545.check +++ b/test/files/neg/t545.check @@ -1,7 +1,4 @@ t545.scala:4: error: value blah is not a member of Test.Foo val x = foo.blah match { ^ -t545.scala:5: error: recursive value x needs type - case List(x) => x - ^ -two errors found +one error found diff --git a/test/files/neg/t5903a.check b/test/files/neg/t5903a.check index cbdcfd1bdd..2e5cc87167 100644 --- a/test/files/neg/t5903a.check +++ b/test/files/neg/t5903a.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: wrong number of patterns for <$anon: AnyRef> offering (SomeTree.type, SomeTree.type): expected 2, found 3 case nq"$x + $y + $z" => println((x, y)) ^ -Test_2.scala:4: error: not found: value x - case nq"$x + $y + $z" => println((x, y)) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903b.check b/test/files/neg/t5903b.check index faeb73ad03..e7637d3edb 100644 --- a/test/files/neg/t5903b.check +++ b/test/files/neg/t5903b.check @@ -3,7 +3,4 @@ Test_2.scala:4: error: type mismatch; required: String case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903c.check b/test/files/neg/t5903c.check index c9476edd11..05bd775d30 100644 --- a/test/files/neg/t5903c.check +++ b/test/files/neg/t5903c.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: String is not supported case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t5903d.check b/test/files/neg/t5903d.check index d5d3fdcc28..9b8526b7f5 100644 --- a/test/files/neg/t5903d.check +++ b/test/files/neg/t5903d.check @@ -1,7 +1,4 @@ Test_2.scala:4: error: extractor macros can only expand into extractor calls case t"$x" => println(x) ^ -Test_2.scala:4: error: not found: value x - case t"$x" => println(x) - ^ -two errors found +one error found diff --git a/test/files/neg/t7895.check b/test/files/neg/t7895.check new file mode 100644 index 0000000000..1a58e24b77 --- /dev/null +++ b/test/files/neg/t7895.check @@ -0,0 +1,4 @@ +t7895.scala:4: error: not found: value Goop + case Goop(a, b, c) => Tuple2(a, b) + ^ +one error found diff --git a/test/files/neg/t7895.scala b/test/files/neg/t7895.scala new file mode 100644 index 0000000000..87a586a82d --- /dev/null +++ b/test/files/neg/t7895.scala @@ -0,0 +1,6 @@ +class A { + (null: Any) match { + // We don't want "symbol not found errors" for `a` and `b` in the case body. + case Goop(a, b, c) => Tuple2(a, b) + } +} diff --git a/test/files/neg/t997.check b/test/files/neg/t997.check index be1e92c369..8c41060ba2 100644 --- a/test/files/neg/t997.check +++ b/test/files/neg/t997.check @@ -4,7 +4,4 @@ t997.scala:13: error: wrong number of patterns for object Foo offering (String, t997.scala:13: error: wrong number of patterns for object Foo offering (String, String): expected 2, found 3 "x" match { case Foo(a, b, c) => Console.println((a,b,c)) } ^ -t997.scala:13: error: not found: value a -"x" match { case Foo(a, b, c) => Console.println((a,b,c)) } - ^ -three errors found +two errors found -- cgit v1.2.3 From 7e4a97e532a9adcd0a6d014d948702aebec3541f Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 8 Oct 2013 22:09:01 +0200 Subject: SI-7895 Issue all buffered errors after silent mode. Rather than just the first. For example, `foo(wizzle, wuzzle, woggle)` should report all three not-found symbols. --- .../scala/tools/nsc/typechecker/Contexts.scala | 1 + .../scala/tools/nsc/typechecker/Typers.scala | 44 ++++++++++++---------- test/files/neg/names-defaults-neg.check | 16 +++++++- test/files/neg/t4515.check | 12 +++++- test/files/neg/t556.check | 5 ++- test/files/neg/t5572.check | 7 +++- test/files/neg/t6829.check | 22 ++++++++++- test/files/neg/t7895b.check | 7 ++++ test/files/neg/t7895b.scala | 5 +++ test/files/neg/typeerror.check | 7 +++- 10 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 test/files/neg/t7895b.check create mode 100644 test/files/neg/t7895b.scala (limited to 'test/files/neg') diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index abc5363423..5e5619d034 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -329,6 +329,7 @@ trait Contexts { self: Analyzer => /** The first error, if any, in the report buffer */ def firstError: Option[AbsTypeError] = reportBuffer.firstError + def errors: Seq[AbsTypeError] = reportBuffer.errors /** Does the report buffer contain any errors? */ def hasErrors = reportBuffer.hasErrors diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index e7371fa26b..0e4797d011 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -79,12 +79,19 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper case SilentResultValue(value) if !p(value) => SilentTypeError(TypeErrorWrapper(new TypeError(NoPosition, "!p"))) case _ => this } - @inline final def orElse[T1 >: T](f: AbsTypeError => T1): T1 = this match { + @inline final def orElse[T1 >: T](f: Seq[AbsTypeError] => T1): T1 = this match { case SilentResultValue(value) => value - case SilentTypeError(err) => f(err) + case s : SilentTypeError => f(s.errors) } } - case class SilentTypeError(err: AbsTypeError) extends SilentResult[Nothing] { } + class SilentTypeError private(val errors: Seq[AbsTypeError]) extends SilentResult[Nothing] { + def err: AbsTypeError = errors.head + } + object SilentTypeError { + def apply(errors: AbsTypeError*): SilentTypeError = new SilentTypeError(errors) + def unapply(error: SilentTypeError): Option[AbsTypeError] = error.errors.headOption + } + case class SilentResultValue[+T](value: T) extends SilentResult[T] { } def newTyper(context: Context): Typer = new NormalTyper(context) @@ -682,14 +689,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper context.undetparams = context1.undetparams context.savedTypeBounds = context1.savedTypeBounds context.namedApplyBlockInfo = context1.namedApplyBlockInfo - context1.firstError match { - case Some(err) => - stopStats() - SilentTypeError(err) - case None => - // If we have a successful result, emit any warnings it created. - context1.flushAndIssueWarnings() - SilentResultValue(result) + if (context1.hasErrors) { + stopStats() + SilentTypeError(context1.errors: _*) + } else { + // If we have a successful result, emit any warnings it created. + context1.flushAndIssueWarnings() + SilentResultValue(result) } } else { assert(context.bufferErrors || isPastTyper, "silent mode is not available past typer") @@ -1258,9 +1264,9 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper reportError } - silent(_.adaptToMember(qual, HasMember(name), reportAmbiguous = false)) orElse (err => + silent(_.adaptToMember(qual, HasMember(name), reportAmbiguous = false)) orElse (errs => onError { - if (reportAmbiguous) context issue err + if (reportAmbiguous) errs foreach (context issue _) setError(tree) } ) @@ -3786,7 +3792,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } } } - def wrapErrors(tree: Tree, typeTree: Typer => Tree): Tree = silent(typeTree) orElse (err => DynamicRewriteError(tree, err)) + def wrapErrors(tree: Tree, typeTree: Typer => Tree): Tree = silent(typeTree) orElse (err => DynamicRewriteError(tree, err.head)) } def typed1(tree: Tree, mode: Mode, pt: Type): Tree = { @@ -4173,7 +4179,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper def tryTypedApply(fun: Tree, args: List[Tree]): Tree = { val start = if (Statistics.canEnable) Statistics.startTimer(failedApplyNanos) else null - def onError(typeError: AbsTypeError): Tree = { + def onError(typeErrors: Seq[AbsTypeError]): Tree = { if (Statistics.canEnable) Statistics.stopTimer(failedApplyNanos, start) // If the problem is with raw types, copnvert to existentials and try again. @@ -4198,13 +4204,13 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper case TypeApply(fun, args) => treesInResult(fun) ++ args.flatMap(treesInResult) case _ => Nil }) - def errorInResult(tree: Tree) = treesInResult(tree) exists (_.pos == typeError.errPos) + def errorInResult(tree: Tree) = treesInResult(tree) exists (err => typeErrors.exists(_.errPos == err.pos)) - val retry = (typeError.errPos != null) && (fun :: tree :: args exists errorInResult) + val retry = (typeErrors.forall(_.errPos != null)) && (fun :: tree :: args exists errorInResult) typingStack.printTyping({ val funStr = ptTree(fun) + " and " + (args map ptTree mkString ", ") if (retry) "second try: " + funStr - else "no second try: " + funStr + " because error not in result: " + typeError.errPos+"!="+tree.pos + else "no second try: " + funStr + " because error not in result: " + typeErrors.head.errPos+"!="+tree.pos }) if (retry) { val Select(qual, name) = fun @@ -4220,7 +4226,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper case _ => () } } - issue(typeError) + typeErrors foreach issue setError(treeCopy.Apply(tree, fun, args)) } diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index cdc12c2490..880ddc4327 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -7,6 +7,11 @@ names-defaults-neg.scala:5: error: type mismatch; required: Int test1(b = 2, a = "#") ^ +names-defaults-neg.scala:5: error: type mismatch; + found : Int(2) + required: String + test1(b = 2, a = "#") + ^ names-defaults-neg.scala:8: error: positional after named argument. test1(b = "(*", 23) ^ @@ -122,6 +127,12 @@ names-defaults-neg.scala:131: error: reference to var2 is ambiguous; it is both names-defaults-neg.scala:134: error: missing parameter type for expanded function ((x$1) => a = x$1) val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) ^ +names-defaults-neg.scala:134: error: not found: value a + val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) + ^ +names-defaults-neg.scala:134: error: not found: value get + val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) + ^ names-defaults-neg.scala:135: error: parameter 'a' is already specified at parameter position 1 val taf3 = testAnnFun(b = _: String, a = get(8)) ^ @@ -131,6 +142,9 @@ names-defaults-neg.scala:136: error: missing parameter type for expanded functio names-defaults-neg.scala:136: error: missing parameter type for expanded function ((x$4) => b = x$4) val taf4: (Int, String) => Unit = testAnnFun(_, b = _) ^ +names-defaults-neg.scala:136: error: not found: value b + val taf4: (Int, String) => Unit = testAnnFun(_, b = _) + ^ names-defaults-neg.scala:144: error: variable definition needs type because 'x' is used as a named argument in its body. def t3 { var x = t.f(x = 1) } ^ @@ -168,4 +182,4 @@ names-defaults-neg.scala:180: error: reference to x is ambiguous; it is both a m class u18 { var x: Int = u.f(x = 1) } ^ four warnings found -42 errors found +46 errors found diff --git a/test/files/neg/t4515.check b/test/files/neg/t4515.check index 64e7cc1ca7..708fcfbd29 100644 --- a/test/files/neg/t4515.check +++ b/test/files/neg/t4515.check @@ -3,4 +3,14 @@ t4515.scala:37: error: type mismatch; required: _$2 handler.onEvent(target, ctx.getEvent, node, ctx) ^ -one error found +t4515.scala:37: error: type mismatch; + found : Main.DerivedPushNode[_$1] where type _$1 + required: Main.PushNode[_$2] + handler.onEvent(target, ctx.getEvent, node, ctx) + ^ +t4515.scala:37: error: type mismatch; + found : Main.PushEventContext[_$1] where type _$1 + required: Main.PushEventContext[_$2] + handler.onEvent(target, ctx.getEvent, node, ctx) + ^ +three errors found diff --git a/test/files/neg/t556.check b/test/files/neg/t556.check index 5135dc92ef..30cc296b35 100644 --- a/test/files/neg/t556.check +++ b/test/files/neg/t556.check @@ -1,4 +1,7 @@ t556.scala:3: error: missing parameter type def g:Int = f((x,y)=>x) ^ -one error found +t556.scala:3: error: missing parameter type + def g:Int = f((x,y)=>x) + ^ +two errors found diff --git a/test/files/neg/t5572.check b/test/files/neg/t5572.check index 7b1e290861..3c9adf41cd 100644 --- a/test/files/neg/t5572.check +++ b/test/files/neg/t5572.check @@ -3,9 +3,14 @@ t5572.scala:16: error: type mismatch; required: A Z.transf(a, b) match { ^ +t5572.scala:16: error: type mismatch; + found : A + required: B + Z.transf(a, b) match { + ^ t5572.scala:18: error: type mismatch; found : A required: B run(sth, b) ^ -two errors found +three errors found diff --git a/test/files/neg/t6829.check b/test/files/neg/t6829.check index c7c641844e..a0b43e3b52 100644 --- a/test/files/neg/t6829.check +++ b/test/files/neg/t6829.check @@ -20,11 +20,31 @@ t6829.scala:50: error: type mismatch; required: _53.State where val _53: G val r = rewards(agent).r(s,a,s2) ^ +t6829.scala:50: error: type mismatch; + found : a.type (with underlying type T2) + required: _53.Action where val _53: G + val r = rewards(agent).r(s,a,s2) + ^ +t6829.scala:50: error: type mismatch; + found : s2.type (with underlying type T3) + required: _53.State where val _53: G + val r = rewards(agent).r(s,a,s2) + ^ t6829.scala:51: error: type mismatch; found : s.type (with underlying type T1) required: _50.State agent.learn(s,a,s2,r): G#Agent ^ +t6829.scala:51: error: type mismatch; + found : a.type (with underlying type T2) + required: _50.Action + agent.learn(s,a,s2,r): G#Agent + ^ +t6829.scala:51: error: type mismatch; + found : s2.type (with underlying type T3) + required: _50.State + agent.learn(s,a,s2,r): G#Agent + ^ t6829.scala:53: error: not found: value nextState Error occurred in an application involving default arguments. copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory) @@ -33,4 +53,4 @@ t6829.scala:53: error: not found: value currentHistory Error occurred in an application involving default arguments. copy(agents = updatedAgents, state = nextState, pastHistory = currentHistory) ^ -9 errors found +13 errors found diff --git a/test/files/neg/t7895b.check b/test/files/neg/t7895b.check new file mode 100644 index 0000000000..87ea72704e --- /dev/null +++ b/test/files/neg/t7895b.check @@ -0,0 +1,7 @@ +t7895b.scala:4: error: not found: value a + foo(a, b) + ^ +t7895b.scala:4: error: not found: value b + foo(a, b) + ^ +two errors found diff --git a/test/files/neg/t7895b.scala b/test/files/neg/t7895b.scala new file mode 100644 index 0000000000..1603027446 --- /dev/null +++ b/test/files/neg/t7895b.scala @@ -0,0 +1,5 @@ +object Test { + def foo(a: Any*) = () + + foo(a, b) +} diff --git a/test/files/neg/typeerror.check b/test/files/neg/typeerror.check index 3ce11dad8a..f117e702f0 100644 --- a/test/files/neg/typeerror.check +++ b/test/files/neg/typeerror.check @@ -3,4 +3,9 @@ typeerror.scala:6: error: type mismatch; required: scala.Long else add2(x.head, y.head) :: add(x.tail, y.tail) ^ -one error found +typeerror.scala:6: error: type mismatch; + found : Long(in method add) + required: scala.Long + else add2(x.head, y.head) :: add(x.tail, y.tail) + ^ +two errors found -- cgit v1.2.3 From 83feb8609161bf19247a8a310f8c5a9e3d8469f5 Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Tue, 8 Oct 2013 22:28:00 +0200 Subject: SI-7985 Typecheck args after failure to typecheck function `missing1.foo(missing2)` now reports `missing1` and `missing2` as not found. Previously, only the first was reported. The arguments are typed with an expected type ErrorType. We propagate this through as the inferred type of anonymous function parameters to avoid issuing cascading "missing parameter type" errors in code like: scala> Nil.mapp(x => abracadabra) :8: error: value mapp is not a member of object Nil Nil.mapp(x => abracadabra) ^ :8: error: not found: value abracadabra Nil.mapp(x => abracadabra) ^ This was in response to unwanted changes in the output of existing neg tests; no new test is added. Similarly, we refine the errors in neg/t6436b.scala by to avoid cascaded errors after: type mismatch; found: StringContext, required: ?{def q: ?} --- .../scala/tools/nsc/typechecker/Typers.scala | 22 ++++++++++++++++------ test/files/neg/any-vs-anyref.check | 18 +++++++++++++++++- test/files/neg/applydynamic_sip.check | 17 ++++++++++++++++- test/files/neg/macro-basic-mamdmi.check | 4 ++-- test/files/neg/reflection-names-neg.check | 5 ++++- test/files/neg/t512.check | 5 ++++- test/files/neg/t5761.check | 5 ++++- test/files/neg/t7895c.check | 13 +++++++++++++ test/files/neg/t7895c.scala | 3 +++ test/files/run/constrained-types.check | 9 +++++++++ test/files/run/repl-reset.check | 6 ++++++ 11 files changed, 94 insertions(+), 13 deletions(-) create mode 100644 test/files/neg/t7895c.check create mode 100644 test/files/neg/t7895c.scala (limited to 'test/files/neg') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 0e4797d011..7bf342f475 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -81,14 +81,20 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper } @inline final def orElse[T1 >: T](f: Seq[AbsTypeError] => T1): T1 = this match { case SilentResultValue(value) => value - case s : SilentTypeError => f(s.errors) + case s : SilentTypeError => f(s.reportableErrors) } } - class SilentTypeError private(val errors: Seq[AbsTypeError]) extends SilentResult[Nothing] { + class SilentTypeError private(val errors: List[AbsTypeError]) extends SilentResult[Nothing] { def err: AbsTypeError = errors.head + def reportableErrors = errors match { + case (e1: AmbiguousImplicitTypeError) +: _ => + List(e1) // DRYer error reporting for neg/t6436b.scala + case all => + all + } } object SilentTypeError { - def apply(errors: AbsTypeError*): SilentTypeError = new SilentTypeError(errors) + def apply(errors: AbsTypeError*): SilentTypeError = new SilentTypeError(errors.toList) def unapply(error: SilentTypeError): Option[AbsTypeError] = error.errors.headOption } @@ -2714,7 +2720,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val FunctionSymbol = FunctionClass(numVparams) val (argpts, respt) = pt baseType FunctionSymbol match { case TypeRef(_, FunctionSymbol, args :+ res) => (args, res) - case _ => (fun.vparams map (_ => NoType), WildcardType) + case _ => (fun.vparams map (_ => if (pt == ErrorType) ErrorType else NoType), WildcardType) } if (argpts.lengthCompare(numVparams) != 0) WrongNumberOfParametersError(fun, argpts) @@ -4278,8 +4284,12 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper tryTypedApply(fun2, args) else doTypedApply(tree, fun2, args, mode, pt) - case SilentTypeError(err) => - onError({ issue(err); setError(tree) }) + case err: SilentTypeError => + onError({ + err.reportableErrors foreach issue + args foreach (arg => typed(arg, mode, ErrorType)) + setError(tree) + }) } } diff --git a/test/files/neg/any-vs-anyref.check b/test/files/neg/any-vs-anyref.check index 63c4853130..7378f0495f 100644 --- a/test/files/neg/any-vs-anyref.check +++ b/test/files/neg/any-vs-anyref.check @@ -36,12 +36,28 @@ Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) ^ +any-vs-anyref.scala:10: error: type mismatch; + found : Quux with Product + required: AnyRef +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo5(x: Quux with Product) = (x eq "abc") && ("abc" eq x) + ^ any-vs-anyref.scala:11: error: value eq is not a member of Quux with Product{def f: Int} Note that the parents of this type (Quux, Product) extend Any, not AnyRef. Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) ^ +any-vs-anyref.scala:11: error: type mismatch; + found : Quux with Product{def f: Int} + required: AnyRef +Note that the parents of this type (Quux, Product) extend Any, not AnyRef. +Such types can participate in value classes, but instances +cannot appear in singleton types or in reference comparisons. + def foo6(x: Quux with Product { def f: Int }) = (x eq "abc") && ("abc" eq x) + ^ any-vs-anyref.scala:12: error: type mismatch; found : Quux with Product{def eq(other: String): Boolean} required: AnyRef @@ -61,4 +77,4 @@ any-vs-anyref.scala:27: error: type mismatch; required: Quux{def g(x: Int): Int} f(new Quux { def g(x: String) = x }) ^ -9 errors found +11 errors found diff --git a/test/files/neg/applydynamic_sip.check b/test/files/neg/applydynamic_sip.check index dcf97b29fc..f28f26c147 100644 --- a/test/files/neg/applydynamic_sip.check +++ b/test/files/neg/applydynamic_sip.check @@ -4,9 +4,18 @@ applydynamic_sip.scala:7: error: applyDynamic does not support passing a vararg applydynamic_sip.scala:8: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg = a, a2: _*) ^ +applydynamic_sip.scala:8: error: not found: value arg + qual.sel(arg = a, a2: _*) + ^ applydynamic_sip.scala:9: error: applyDynamicNamed does not support passing a vararg parameter qual.sel(arg, arg2 = "a2", a2: _*) ^ +applydynamic_sip.scala:9: error: not found: value arg + qual.sel(arg, arg2 = "a2", a2: _*) + ^ +applydynamic_sip.scala:9: error: not found: value arg2 + qual.sel(arg, arg2 = "a2", a2: _*) + ^ applydynamic_sip.scala:18: error: type mismatch; found : String("sel") required: Int @@ -28,6 +37,9 @@ error after rewriting to Test.this.bad1.applyDynamicNamed("sel") possible cause: maybe a wrong Dynamic method signature? bad1.sel(a = 1) ^ +applydynamic_sip.scala:20: error: reassignment to val + bad1.sel(a = 1) + ^ applydynamic_sip.scala:21: error: type mismatch; found : String("sel") required: Int @@ -50,9 +62,12 @@ error after rewriting to Test.this.bad2.applyDynamicNamed("sel") possible cause: maybe a wrong Dynamic method signature? bad2.sel(a = 1) ^ +applydynamic_sip.scala:31: error: reassignment to val + bad2.sel(a = 1) + ^ applydynamic_sip.scala:32: error: Int does not take parameters error after rewriting to Test.this.bad2.updateDynamic("sel") possible cause: maybe a wrong Dynamic method signature? bad2.sel = 1 ^ -11 errors found +16 errors found diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check index 621d318ceb..9328fbd51c 100644 --- a/test/files/neg/macro-basic-mamdmi.check +++ b/test/files/neg/macro-basic-mamdmi.check @@ -1,5 +1,5 @@ -Impls_Macros_Test_1.scala:36: error: macro implementation not found: foo +Impls_Macros_Test_1.scala:36: error: macro implementation not found: quux (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) println(foo(2) + Macros.bar(2) * new Macros().quux(4)) - ^ + ^ one error found diff --git a/test/files/neg/reflection-names-neg.check b/test/files/neg/reflection-names-neg.check index a56a19e7fd..f941ec8dc1 100644 --- a/test/files/neg/reflection-names-neg.check +++ b/test/files/neg/reflection-names-neg.check @@ -7,4 +7,7 @@ Note that implicit conversions are not applicable because they are ambiguous: are possible conversion functions from String("abc") to reflect.runtime.universe.Name val x2 = ("abc": Name) drop 1 // error ^ -one error found +reflection-names-neg.scala:5: error: value drop is not a member of reflect.runtime.universe.Name + val x2 = ("abc": Name) drop 1 // error + ^ +two errors found diff --git a/test/files/neg/t512.check b/test/files/neg/t512.check index 814e65e405..051e5ee19f 100644 --- a/test/files/neg/t512.check +++ b/test/files/neg/t512.check @@ -1,4 +1,7 @@ t512.scala:3: error: not found: value something val xxx = something || ^ -one error found +t512.scala:4: error: not found: value something_else + something_else; + ^ +two errors found diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check index 89d766fe34..2d66af26f6 100644 --- a/test/files/neg/t5761.check +++ b/test/files/neg/t5761.check @@ -13,4 +13,7 @@ Unspecified value parameter x. t5761.scala:13: error: not found: type Tread new Tread("sth") { }.run() ^ -four errors found +t5761.scala:13: error: value run is not a member of AnyRef + new Tread("sth") { }.run() + ^ +5 errors found diff --git a/test/files/neg/t7895c.check b/test/files/neg/t7895c.check new file mode 100644 index 0000000000..d4745b1f4b --- /dev/null +++ b/test/files/neg/t7895c.check @@ -0,0 +1,13 @@ +t7895c.scala:2: error: not found: value bong + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value booble + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value bippity + def booboo = bong + booble + bippity - bazingo + ^ +t7895c.scala:2: error: not found: value bazingo + def booboo = bong + booble + bippity - bazingo + ^ +four errors found diff --git a/test/files/neg/t7895c.scala b/test/files/neg/t7895c.scala new file mode 100644 index 0000000000..53d2a8672e --- /dev/null +++ b/test/files/neg/t7895c.scala @@ -0,0 +1,3 @@ +class A { + def booboo = bong + booble + bippity - bazingo +} diff --git a/test/files/run/constrained-types.check b/test/files/run/constrained-types.check index f022aac1b2..d965d8a2ff 100644 --- a/test/files/run/constrained-types.check +++ b/test/files/run/constrained-types.check @@ -138,6 +138,15 @@ scala> val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message :8: error: not found: value e val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message ^ +:8: error: not found: value f + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message + ^ +:8: error: not found: value g + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message + ^ +:8: error: not found: value h + val x = 3 : Int @Annot(e+f+g+h) // should have a graceful error message + ^ scala> diff --git a/test/files/run/repl-reset.check b/test/files/run/repl-reset.check index c6e147977a..ed95c7b8ff 100644 --- a/test/files/run/repl-reset.check +++ b/test/files/run/repl-reset.check @@ -33,6 +33,12 @@ scala> x1 + x2 + x3 :8: error: not found: value x1 x1 + x2 + x3 ^ +:8: error: not found: value x2 + x1 + x2 + x3 + ^ +:8: error: not found: value x3 + x1 + x2 + x3 + ^ scala> val x1 = 4 x1: Int = 4 -- cgit v1.2.3