From f7a315adf63fdac2a7f95f87b88e03d4139af863 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Wed, 18 Sep 2013 07:48:57 -0700 Subject: SI-7854, SI-6768 better parsing/positioning in parser The parser hole I found while working on the generated positions serves as the umbrella for a host of improvements. Upgraded positions assigned during some specific challenging situations mostly involving the creation of synthetic trees, e.g. for comprehensions and closures. While doing so improved some error messages. Eliminated some of the most glaring duplication in the parser. It's written like there is some payoff associated with being spectacularly imperative. Not so far. --- test/files/continuations-run/t5472.check | 2 +- .../neg/classmanifests_new_deprecations.check | 4 +- test/files/neg/divergent-implicit.check | 4 +- test/files/neg/for-comprehension-old.check | 8 ++-- test/files/neg/found-req-variance.check | 20 ++++----- test/files/neg/lazyvals.check | 4 +- test/files/neg/multi-array.check | 2 +- test/files/neg/names-defaults-neg.check | 2 +- test/files/neg/nested-annotation.check | 2 +- test/files/neg/no-implicit-to-anyref.check | 2 +- test/files/neg/no-predef.check | 2 +- test/files/neg/parser-errors.check | 16 +++---- test/files/neg/parser-errors.scala | 2 +- test/files/neg/parser-import-errors.check | 28 +++++++++++++ test/files/neg/parser-import-errors.scala | 49 ++++++++++++++++++++++ test/files/neg/primitive-sigs-1.check | 2 +- test/files/neg/protected-constructors.check | 4 +- test/files/neg/saito.check | 2 +- test/files/neg/sensitive.check | 2 +- test/files/neg/stringinterpolation_macro-neg.check | 2 +- test/files/neg/t0209.check | 2 +- test/files/neg/t1038.check | 2 +- test/files/neg/t1623.check | 2 +- test/files/neg/t1705.check | 2 +- test/files/neg/t2775.check | 2 +- test/files/neg/t3453.check | 8 ++-- test/files/neg/t3692-new.check | 2 +- test/files/neg/t3977.check | 2 +- test/files/neg/t4163.check | 7 +--- test/files/neg/t4417.check | 2 +- test/files/neg/t4727.check | 2 +- test/files/neg/t4851.check | 12 +++--- test/files/neg/t4987.check | 2 +- test/files/neg/t5120.check | 4 +- test/files/neg/t5666.check | 24 +++++------ test/files/neg/t5761.check | 2 +- test/files/neg/t5803.check | 2 +- test/files/neg/t6074.check | 2 +- test/files/neg/t6601.check | 2 +- test/files/neg/t6667b.check | 4 +- test/files/neg/t7385.check | 9 ++-- test/files/neg/t7473.check | 12 ++---- test/files/neg/t771.check | 2 +- test/files/pos/t7854.scala | 5 +++ test/files/run/existential-rangepos.check | 4 +- test/files/run/t5603.check | 12 +++--- test/files/run/t6768.check | 2 +- 47 files changed, 181 insertions(+), 111 deletions(-) create mode 100644 test/files/neg/parser-import-errors.check create mode 100644 test/files/neg/parser-import-errors.scala create mode 100644 test/files/pos/t7854.scala (limited to 'test') diff --git a/test/files/continuations-run/t5472.check b/test/files/continuations-run/t5472.check index 3192c746eb..1af7767f6d 100644 --- a/test/files/continuations-run/t5472.check +++ b/test/files/continuations-run/t5472.check @@ -5,7 +5,7 @@ t5472.scala:12: warning: expression case4(){ case5() } is cps-transformed unexpectedly (location, accessors) <- new ContinuationizedParallelIterable(map) - ^ + ^ t5472.scala:12: warning: expression matchEnd3(x: Int){ x } is cps-transformed unexpectedly diff --git a/test/files/neg/classmanifests_new_deprecations.check b/test/files/neg/classmanifests_new_deprecations.check index fd1e2728c3..39b6bf216c 100644 --- a/test/files/neg/classmanifests_new_deprecations.check +++ b/test/files/neg/classmanifests_new_deprecations.check @@ -1,6 +1,6 @@ classmanifests_new_deprecations.scala:2: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead def cm1[T: ClassManifest] = ??? - ^ + ^ classmanifests_new_deprecations.scala:3: warning: type ClassManifest in object Predef is deprecated: Use `scala.reflect.ClassTag` instead def cm2[T](implicit evidence$1: ClassManifest[T]) = ??? ^ @@ -9,7 +9,7 @@ classmanifests_new_deprecations.scala:4: warning: type ClassManifest in object P ^ classmanifests_new_deprecations.scala:6: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm1[T: scala.reflect.ClassManifest] = ??? - ^ + ^ classmanifests_new_deprecations.scala:7: warning: type ClassManifest in package reflect is deprecated: Use scala.reflect.ClassTag instead def rcm2[T](implicit evidence$1: scala.reflect.ClassManifest[T]) = ??? ^ diff --git a/test/files/neg/divergent-implicit.check b/test/files/neg/divergent-implicit.check index 5f20df1b91..b5c607cf59 100644 --- a/test/files/neg/divergent-implicit.check +++ b/test/files/neg/divergent-implicit.check @@ -10,9 +10,9 @@ starting with method cast in object Test1 divergent-implicit.scala:14: error: diverging implicit expansion for type Test2.Baz => Test2.Bar starting with method baz2bar in object Test2 val x: Bar = new Foo - ^ + ^ divergent-implicit.scala:15: error: diverging implicit expansion for type Test2.Foo => Test2.Bar starting with method foo2bar in object Test2 val y: Bar = new Baz - ^ + ^ four errors found diff --git a/test/files/neg/for-comprehension-old.check b/test/files/neg/for-comprehension-old.check index 1ecaf12af4..fc04beca53 100644 --- a/test/files/neg/for-comprehension-old.check +++ b/test/files/neg/for-comprehension-old.check @@ -1,15 +1,15 @@ for-comprehension-old.scala:3: warning: val keyword in for comprehension is deprecated for (x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:5: warning: val keyword in for comprehension is deprecated for (val x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:8: warning: val keyword in for comprehension is deprecated for (z <- 1 to 2 ; x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:10: warning: val keyword in for comprehension is deprecated for (z <- 1 to 2 ; val x <- 1 to 5 ; val y = x) yield x+y // fail - ^ + ^ for-comprehension-old.scala:4: error: val in for comprehension must be followed by assignment for (val x <- 1 to 5 ; y = x) yield x+y // fail ^ diff --git a/test/files/neg/found-req-variance.check b/test/files/neg/found-req-variance.check index cc26458ac5..55a01012a9 100644 --- a/test/files/neg/found-req-variance.check +++ b/test/files/neg/found-req-variance.check @@ -4,56 +4,56 @@ found-req-variance.scala:22: error: type mismatch; Note: B <: A, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f2 = Set[Inv[A]]() + new Inv[B] - ^ + ^ found-req-variance.scala:23: error: type mismatch; found : Inv[C] required: Inv[A] Note: C <: A, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f3 = Set[Inv[A]]() + new Inv[C] - ^ + ^ found-req-variance.scala:24: error: type mismatch; found : Inv[A] required: Inv[B] Note: A >: B, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f4 = Set[Inv[B]]() + new Inv[A] - ^ + ^ found-req-variance.scala:26: error: type mismatch; found : Inv[C] required: Inv[B] Note: C <: B, but class Inv is invariant in type T. You may wish to define T as +T instead. (SLS 4.5) def f6 = Set[Inv[B]]() + new Inv[C] - ^ + ^ found-req-variance.scala:27: error: type mismatch; found : Inv[A] required: Inv[C] Note: A >: C, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f7 = Set[Inv[C]]() + new Inv[A] - ^ + ^ found-req-variance.scala:28: error: type mismatch; found : Inv[B] required: Inv[C] Note: B >: C, but class Inv is invariant in type T. You may wish to define T as -T instead. (SLS 4.5) def f8 = Set[Inv[C]]() + new Inv[B] - ^ + ^ found-req-variance.scala:34: error: type mismatch; found : MultiInv[A] required: Multi[A,B,C] Note: A >: B (and MultiInv[A] <: Multi[A,A,C]), but class Multi is invariant in type Inv. You may wish to define Inv as -Inv instead. (SLS 4.5) def g4 = Set[Multi[A, B, C]]() + new MultiInv[A] - ^ + ^ found-req-variance.scala:36: error: type mismatch; found : MultiInv[C] required: Multi[A,B,C] Note: C <: B (and MultiInv[C] <: Multi[A,C,C]), but class Multi is invariant in type Inv. You may wish to define Inv as +Inv instead. (SLS 4.5) def g6 = Set[Multi[A, B, C]]() + new MultiInv[C] - ^ + ^ found-req-variance.scala:47: error: type mismatch; found : FF1[A,A] required: FF1[B,B] @@ -160,7 +160,7 @@ found-req-variance.scala:94: error: type mismatch; Note: Int <: AnyVal (and Misc.MyData <: Misc.Data[Int]), but class Data is invariant in type A. You may wish to define A as +A instead. (SLS 4.5) def f1 = Set[Data[AnyVal]]() + new MyData - ^ + ^ found-req-variance.scala:100: error: type mismatch; found : Set[String] required: Set[CharSequence] @@ -174,7 +174,7 @@ found-req-variance.scala:104: error: type mismatch; Note: String <: Object, but class Trippy is invariant in type T2. You may wish to define T2 as +T2 instead. (SLS 4.5) def g1 = Set[Trippy[AnyRef, AnyRef, AnyRef]]() + new Trippy[String, String, String] - ^ + ^ found-req-variance.scala:105: error: type mismatch; found : scala.collection.immutable.Map[AnyRef,String] required: Map[String,String] diff --git a/test/files/neg/lazyvals.check b/test/files/neg/lazyvals.check index c4daf9d842..1ae8b13d92 100644 --- a/test/files/neg/lazyvals.check +++ b/test/files/neg/lazyvals.check @@ -7,9 +7,9 @@ lazyvals.scala:9: error: lazy not allowed here. Only vals can be lazy lazyvals.scala:12: error: lazy not allowed here. Only vals can be lazy lazy def q: Double = 0.0 ^ -lazyvals.scala:15: error: '=' expected but ';' found. +lazyvals.scala:15: error: lazy values may not be abstract lazy val t; - ^ + ^ lazyvals.scala:20: error: lazy not allowed here. Only vals can be lazy lazy trait T {} ^ diff --git a/test/files/neg/multi-array.check b/test/files/neg/multi-array.check index 511caa126f..6bdeb34c9e 100644 --- a/test/files/neg/multi-array.check +++ b/test/files/neg/multi-array.check @@ -1,4 +1,4 @@ multi-array.scala:7: error: too many arguments for constructor Array: (_length: Int)Array[T] val a: Array[Int] = new Array(10, 10) - ^ + ^ one error found diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index cdc12c2490..4966779cc3 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -97,7 +97,7 @@ names-defaults-neg.scala:82: error: type mismatch; required: String Error occurred in an application involving default arguments. new A2[String]() - ^ + ^ names-defaults-neg.scala:86: error: module extending its companion class cannot use default constructor arguments object C extends C() ^ diff --git a/test/files/neg/nested-annotation.check b/test/files/neg/nested-annotation.check index ca263943fe..c077d35a29 100644 --- a/test/files/neg/nested-annotation.check +++ b/test/files/neg/nested-annotation.check @@ -5,6 +5,6 @@ class ComplexAnnotation(val value: Annotation) extends ClassfileAnnotation ^ nested-annotation.scala:8: error: nested classfile annotations must be defined in java; found: inline @ComplexAnnotation(new inline) def bippy(): Int = 1 - ^ + ^ one warning found one error found diff --git a/test/files/neg/no-implicit-to-anyref.check b/test/files/neg/no-implicit-to-anyref.check index fe417ad8b0..5ab5fd12a1 100644 --- a/test/files/neg/no-implicit-to-anyref.check +++ b/test/files/neg/no-implicit-to-anyref.check @@ -18,5 +18,5 @@ Note that AV extends Any, not AnyRef. Such types can participate in value classes, but instances cannot appear in singleton types or in reference comparisons. new AV(0): AnyRef - ^ + ^ four errors found diff --git a/test/files/neg/no-predef.check b/test/files/neg/no-predef.check index a63d8c5ba5..fc538892ef 100644 --- a/test/files/neg/no-predef.check +++ b/test/files/neg/no-predef.check @@ -7,7 +7,7 @@ no-predef.scala:3: error: type mismatch; found : java.lang.Long required: scala.Long def f2 = new java.lang.Long(5) : Long - ^ + ^ no-predef.scala:4: error: value map is not a member of String def f3 = "abc" map (_ + 1) ^ diff --git a/test/files/neg/parser-errors.check b/test/files/neg/parser-errors.check index ab13ee0921..0ab3331c0c 100644 --- a/test/files/neg/parser-errors.check +++ b/test/files/neg/parser-errors.check @@ -1,16 +1,16 @@ parser-errors.scala:1: error: lazy values may not be abstract abstract class A1 { lazy val foo: Int } ^ -parser-errors.scala:2: error: '=' expected but '}' found. +parser-errors.scala:2: error: pattern definition may not be abstract abstract class A2 { val Some(x) } - ^ -parser-errors.scala:3: error: unbound placeholder parameter -abstract class A3 { var x = _ } ^ -parser-errors.scala:4: error: unbound placeholder parameter +parser-errors.scala:3: error: an explicit type is required for default initialization +abstract class A3 { var x = _ } + ^ +parser-errors.scala:4: error: only vars are eligible for default initialization abstract class A4 { val x: Int = _ } - ^ -parser-errors.scala:5: error: unbound placeholder parameter + ^ +parser-errors.scala:5: error: pattern definition is ineligible for default initialization abstract class A5 { var Some(x) = _ } - ^ + ^ 5 errors found diff --git a/test/files/neg/parser-errors.scala b/test/files/neg/parser-errors.scala index 1bf121f68f..7b1a290629 100644 --- a/test/files/neg/parser-errors.scala +++ b/test/files/neg/parser-errors.scala @@ -2,4 +2,4 @@ abstract class A1 { lazy val foo: Int } abstract class A2 { val Some(x) } abstract class A3 { var x = _ } abstract class A4 { val x: Int = _ } -abstract class A5 { var Some(x) = _ } \ No newline at end of file +abstract class A5 { var Some(x) = _ } diff --git a/test/files/neg/parser-import-errors.check b/test/files/neg/parser-import-errors.check new file mode 100644 index 0000000000..e211c275a6 --- /dev/null +++ b/test/files/neg/parser-import-errors.check @@ -0,0 +1,28 @@ +parser-import-errors.scala:12: error: not found: type B1 + new B1 + ^ +parser-import-errors.scala:13: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:19: error: object X1 is not a member of package p1 + import p1.{ A1 => X1, X1 => A1 } + ^ +parser-import-errors.scala:21: error: not found: type A1 + new A1 + ^ +parser-import-errors.scala:22: error: not found: type B1 + new B1 + ^ +parser-import-errors.scala:23: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:33: error: not found: type C1 + new C1 + ^ +parser-import-errors.scala:38: error: A1 appears twice as a target of a renaming + import p1.{ A1, B1 => A1 } + ^ +parser-import-errors.scala:45: error: object Z1 is not a member of package p1 + import p1.{ Z1, B1 => Z1 } + ^ +9 errors found diff --git a/test/files/neg/parser-import-errors.scala b/test/files/neg/parser-import-errors.scala new file mode 100644 index 0000000000..010bb95a1e --- /dev/null +++ b/test/files/neg/parser-import-errors.scala @@ -0,0 +1,49 @@ +package p1 { + class A1 + class B1 + class C1 +} + +package p2 { + import p1.{ A1, B1 => Q1, C1 => _ } + + class X { + new A1 + new B1 + new C1 + new Q1 + } +} + +package p3 { + import p1.{ A1 => X1, X1 => A1 } + class X { + new A1 + new B1 + new C1 + new X1 + } +} + +package p4 { + import p1.{ A1 => B1, B1 => A1 } + class X { + new A1 + new B1 + new C1 + } +} + +package p5 { + import p1.{ A1, B1 => A1 } + class X { + new A1 + } +} + +package p6 { + import p1.{ Z1, B1 => Z1 } + class X { + new Z1 + } +} diff --git a/test/files/neg/primitive-sigs-1.check b/test/files/neg/primitive-sigs-1.check index 77dc457a49..d0619fa1d3 100644 --- a/test/files/neg/primitive-sigs-1.check +++ b/test/files/neg/primitive-sigs-1.check @@ -2,5 +2,5 @@ B.scala:3: error: type mismatch; found : Bippy required: AC[Integer] J.f(new Bippy()) - ^ + ^ one error found diff --git a/test/files/neg/protected-constructors.check b/test/files/neg/protected-constructors.check index f44d7db9b9..b636d076e4 100644 --- a/test/files/neg/protected-constructors.check +++ b/test/files/neg/protected-constructors.check @@ -1,12 +1,12 @@ protected-constructors.scala:17: error: too many arguments for constructor Foo1: ()dingus.Foo1 val foo1 = new Foo1("abc") - ^ + ^ protected-constructors.scala:18: error: constructor Foo2 in class Foo2 cannot be accessed in object P Access to protected constructor Foo2 not permitted because enclosing object P in package hungus is not a subclass of class Foo2 in package dingus where target is defined val foo2 = new Foo2("abc") - ^ + ^ protected-constructors.scala:19: error: class Foo3 in object Ding cannot be accessed in object dingus.Ding Access to protected class Foo3 not permitted because enclosing object P in package hungus is not a subclass of diff --git a/test/files/neg/saito.check b/test/files/neg/saito.check index 061a45b76e..f78b300b4c 100644 --- a/test/files/neg/saito.check +++ b/test/files/neg/saito.check @@ -1,4 +1,4 @@ saito.scala:10: error: class A cannot be instantiated because it does not conform to its self-type A with B val a: A = new A; // should not be allowed - ^ + ^ one error found diff --git a/test/files/neg/sensitive.check b/test/files/neg/sensitive.check index 32d988ec97..9270e639c3 100644 --- a/test/files/neg/sensitive.check +++ b/test/files/neg/sensitive.check @@ -1,4 +1,4 @@ sensitive.scala:17: error: constructor Sensitive in class Sensitive cannot be accessed in object Attacker val y = new Sensitive() - ^ + ^ one error found diff --git a/test/files/neg/stringinterpolation_macro-neg.check b/test/files/neg/stringinterpolation_macro-neg.check index 457f497f2f..fa4f2c9472 100644 --- a/test/files/neg/stringinterpolation_macro-neg.check +++ b/test/files/neg/stringinterpolation_macro-neg.check @@ -1,6 +1,6 @@ stringinterpolation_macro-neg.scala:8: error: too few parts new StringContext().f() - ^ + ^ stringinterpolation_macro-neg.scala:9: error: too few arguments for interpolated string new StringContext("", " is ", "%2d years old").f(s) ^ diff --git a/test/files/neg/t0209.check b/test/files/neg/t0209.check index 1904e58e7a..4ba5fef4e9 100644 --- a/test/files/neg/t0209.check +++ b/test/files/neg/t0209.check @@ -2,5 +2,5 @@ t0209.scala:15: error: type mismatch; found : C required: _1.type where val _1: A (new B: A).f(new C) - ^ + ^ one error found diff --git a/test/files/neg/t1038.check b/test/files/neg/t1038.check index b191b89ad1..c74d8b338f 100644 --- a/test/files/neg/t1038.check +++ b/test/files/neg/t1038.check @@ -1,5 +1,5 @@ t1038.scala:4: error: not enough arguments for constructor X: (x: Int)X. Unspecified value parameter x. val a = new X - ^ + ^ one error found diff --git a/test/files/neg/t1623.check b/test/files/neg/t1623.check index 251039ad30..e30db5cddd 100644 --- a/test/files/neg/t1623.check +++ b/test/files/neg/t1623.check @@ -1,4 +1,4 @@ t1623.scala:11: error: class BImpl cannot be instantiated because it does not conform to its self-type test.BImpl with test.A val b = new BImpl - ^ + ^ one error found diff --git a/test/files/neg/t1705.check b/test/files/neg/t1705.check index 7f75bd0fb5..12f5c27de6 100644 --- a/test/files/neg/t1705.check +++ b/test/files/neg/t1705.check @@ -1,6 +1,6 @@ t1705.scala:9: error: can't existentially abstract over parameterized type this.T[Z] val c = new C{ - ^ + ^ t1705.scala:14: error: can't existentially abstract over parameterized type C[String] val x1 = { ^ diff --git a/test/files/neg/t2775.check b/test/files/neg/t2775.check index 934a970f2e..2c901665d6 100644 --- a/test/files/neg/t2775.check +++ b/test/files/neg/t2775.check @@ -1,4 +1,4 @@ t2775.scala:1: error: cannot find class tag for element type B.this.T trait B[S] { type T = S; val c = new Array[T](1) } - ^ + ^ one error found diff --git a/test/files/neg/t3453.check b/test/files/neg/t3453.check index 52c948128c..2472e8b212 100644 --- a/test/files/neg/t3453.check +++ b/test/files/neg/t3453.check @@ -2,20 +2,20 @@ t3453.scala:18: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:36: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:50: error: type mismatch; found : A required: B new A - ^ + ^ t3453.scala:64: error: type mismatch; found : A required: B new A - ^ + ^ four errors found diff --git a/test/files/neg/t3692-new.check b/test/files/neg/t3692-new.check index 9b96449930..358eaed41e 100644 --- a/test/files/neg/t3692-new.check +++ b/test/files/neg/t3692-new.check @@ -9,7 +9,7 @@ t3692-new.scala:16: warning: non-variable type argument Int in type pattern Map[ ^ t3692-new.scala:15: warning: unreachable code case m1: Map[Int, V] => new java.util.HashMap[Integer, V] - ^ + ^ t3692-new.scala:4: warning: Tester has a main method with parameter type Array[String], but Tester will not be a runnable program. Reason: main method must have exact signature (Array[String])Unit object Tester { diff --git a/test/files/neg/t3977.check b/test/files/neg/t3977.check index 72335a0926..4242059463 100644 --- a/test/files/neg/t3977.check +++ b/test/files/neg/t3977.check @@ -1,4 +1,4 @@ t3977.scala:12: error: could not find implicit value for parameter w: False#If[E] new NoNull - ^ + ^ one error found diff --git a/test/files/neg/t4163.check b/test/files/neg/t4163.check index 47bc78d31c..a09a522e3a 100644 --- a/test/files/neg/t4163.check +++ b/test/files/neg/t4163.check @@ -1,7 +1,4 @@ -t4163.scala:4: error: '<-' expected but '=' found. +t4163.scala:4: error: for comprehension must start with generator: '<-' expected but '=' found. x = 3 ^ -t4163.scala:5: error: illegal start of simple expression - y <- 0 to 100 -^ -two errors found +one error found diff --git a/test/files/neg/t4417.check b/test/files/neg/t4417.check index dbd0f1df46..dfc9feca24 100644 --- a/test/files/neg/t4417.check +++ b/test/files/neg/t4417.check @@ -3,5 +3,5 @@ t4417.scala:11: error: constructor Pixel$mcD$sp in class Pixel$mcD$sp cannot be enclosing object Pixel is not a subclass of class Pixel$mcD$sp where target is defined def apply(v: Double): Pixel1d = new Pixel1d(v) - ^ + ^ one error found diff --git a/test/files/neg/t4727.check b/test/files/neg/t4727.check index a17cdde044..55d4d01b97 100644 --- a/test/files/neg/t4727.check +++ b/test/files/neg/t4727.check @@ -1,5 +1,5 @@ t4727.scala:5: error: an expression of type Null is ineligible for implicit conversion Error occurred in an application involving default arguments. new C[Int] - ^ + ^ one error found diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 4f2919807e..6d0f424e82 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -3,19 +3,19 @@ S.scala:2: warning: Adapting argument list by inserting (): leaky (Object-receiv given arguments: after adaptation: new J((): Unit) val x1 = new J - ^ + ^ S.scala:3: warning: Adapting argument list by inserting (): leaky (Object-receiving) target makes this especially dangerous. signature: J(x: Any): J given arguments: after adaptation: new J((): Unit) val x2 = new J() - ^ + ^ S.scala:4: warning: Adapting argument list by creating a 5-tuple: this may not be what you want. signature: J(x: Any): J given arguments: 1, 2, 3, 4, 5 after adaptation: new J((1, 2, 3, 4, 5): (Int, Int, Int, Int, Int)) val x3 = new J(1, 2, 3, 4, 5) - ^ + ^ S.scala:6: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Some.apply[A](x: A): Some[A] given arguments: 1, 2, 3 @@ -27,19 +27,19 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b given arguments: 1, 2, 3 after adaptation: new Some((1, 2, 3): (Int, Int, Int)) val y2 = new Some(1, 2, 3) - ^ + ^ S.scala:9: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: after adaptation: new J2((): Unit) val z1 = new J2 - ^ + ^ S.scala:10: warning: Adapting argument list by inserting (): this is unlikely to be what you want. signature: J2[T](x: T): J2[T] given arguments: after adaptation: new J2((): Unit) val z2 = new J2() - ^ + ^ S.scala:14: warning: Adapting argument list by creating a 3-tuple: this may not be what you want. signature: Test.anyId(a: Any): Any given arguments: 1, 2, 3 diff --git a/test/files/neg/t4987.check b/test/files/neg/t4987.check index 8d7344d27b..ee058f0ac1 100644 --- a/test/files/neg/t4987.check +++ b/test/files/neg/t4987.check @@ -1,4 +1,4 @@ t4987.scala:2: error: constructor Foo2 in class Foo2 cannot be accessed in object Bar2 object Bar2 { new Foo2(0, 0) } - ^ + ^ one error found diff --git a/test/files/neg/t5120.check b/test/files/neg/t5120.check index 34d4ebde31..fc65ca16a5 100644 --- a/test/files/neg/t5120.check +++ b/test/files/neg/t5120.check @@ -2,11 +2,11 @@ t5120.scala:11: error: type mismatch; found : Object required: _1 List(str, other) foreach (_.x1 = new AnyRef) - ^ + ^ t5120.scala:25: error: type mismatch; found : Thread required: h.T (which expands to) _2 List(str, num).foreach(h => h.f1 = new Thread()) - ^ + ^ two errors found diff --git a/test/files/neg/t5666.check b/test/files/neg/t5666.check index 1c714796ba..da6b9d73e7 100644 --- a/test/files/neg/t5666.check +++ b/test/files/neg/t5666.check @@ -1,37 +1,37 @@ t5666.scala:2: error: class Any is abstract; cannot be instantiated new Any - ^ + ^ t5666.scala:3: error: class AnyVal is abstract; cannot be instantiated new AnyVal - ^ + ^ t5666.scala:4: error: class Double is abstract; cannot be instantiated new Double - ^ + ^ t5666.scala:5: error: class Float is abstract; cannot be instantiated new Float - ^ + ^ t5666.scala:6: error: class Long is abstract; cannot be instantiated new Long - ^ + ^ t5666.scala:7: error: class Int is abstract; cannot be instantiated new Int - ^ + ^ t5666.scala:8: error: class Char is abstract; cannot be instantiated new Char - ^ + ^ t5666.scala:9: error: class Short is abstract; cannot be instantiated new Short - ^ + ^ t5666.scala:10: error: class Byte is abstract; cannot be instantiated new Byte - ^ + ^ t5666.scala:11: error: class Boolean is abstract; cannot be instantiated new Boolean - ^ + ^ t5666.scala:12: error: class Unit is abstract; cannot be instantiated new Unit - ^ + ^ t5666.scala:13: error: class Nothing is abstract; cannot be instantiated new Nothing - ^ + ^ 12 errors found diff --git a/test/files/neg/t5761.check b/test/files/neg/t5761.check index 89d766fe34..8086af2fcf 100644 --- a/test/files/neg/t5761.check +++ b/test/files/neg/t5761.check @@ -5,7 +5,7 @@ Unspecified value parameter x. t5761.scala:8: error: not enough arguments for constructor D: (x: Int)D[Int]. Unspecified value parameter x. println(new D[Int]()) // no crash - ^ + ^ t5761.scala:9: error: not enough arguments for constructor D: (x: Int)D[Int]. Unspecified value parameter x. println(new D[Int]{}) // crash diff --git a/test/files/neg/t5803.check b/test/files/neg/t5803.check index 6a2de2e1df..c4f901e511 100644 --- a/test/files/neg/t5803.check +++ b/test/files/neg/t5803.check @@ -1,4 +1,4 @@ t5803.scala:3: error: could not find implicit value for parameter ev: Nothing new Foo(): String - ^ + ^ one error found diff --git a/test/files/neg/t6074.check b/test/files/neg/t6074.check index 38670e5b3d..6abf5e2906 100644 --- a/test/files/neg/t6074.check +++ b/test/files/neg/t6074.check @@ -1,4 +1,4 @@ t6074.scala:5: error: constructor A in class A cannot be accessed in object T def t = new A() - ^ + ^ one error found diff --git a/test/files/neg/t6601.check b/test/files/neg/t6601.check index 1410e1b11a..b05c67ad9a 100644 --- a/test/files/neg/t6601.check +++ b/test/files/neg/t6601.check @@ -1,4 +1,4 @@ AccessPrivateConstructor_2.scala:2: error: constructor PrivateConstructor in class PrivateConstructor cannot be accessed in class AccessPrivateConstructor new PrivateConstructor("") // Scalac should forbid accessing to the private constructor! - ^ + ^ one error found diff --git a/test/files/neg/t6667b.check b/test/files/neg/t6667b.check index 99cea9a47c..a8705fa1c2 100644 --- a/test/files/neg/t6667b.check +++ b/test/files/neg/t6667b.check @@ -3,11 +3,11 @@ t6667b.scala:16: error: ambiguous implicit values: and value b of type Test.Box match expected type Test.Box new Test() - ^ + ^ t6667b.scala:19: error: ambiguous implicit values: both value a in object Test of type => Test.Box and value b of type Test.Box match expected type Test.Box new Test() - ^ + ^ two errors found diff --git a/test/files/neg/t7385.check b/test/files/neg/t7385.check index 70d3c3fb61..c196ec0b4f 100644 --- a/test/files/neg/t7385.check +++ b/test/files/neg/t7385.check @@ -1,10 +1,7 @@ -t7385.scala:2: error: '(' expected but identifier found. +t7385.scala:2: error: parenthesized conditional expression expected do { println("bippy") } while i<10 ^ -t7385.scala:6: error: '(' expected but identifier found. +t7385.scala:6: error: parenthesized conditional expression expected while i<10 { () } ^ -t7385.scala:7: error: illegal start of simple expression -} -^ -three errors found +two errors found diff --git a/test/files/neg/t7473.check b/test/files/neg/t7473.check index 488baef94e..c686466a44 100644 --- a/test/files/neg/t7473.check +++ b/test/files/neg/t7473.check @@ -1,13 +1,7 @@ -t7473.scala:5: error: '<-' expected but '=' found. +t7473.scala:5: error: for comprehension must start with generator: '<-' expected but '=' found. for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. ^ -t7473.scala:5: error: illegal start of simple expression - for (x = Option(i); if x == j) yield 42 //t7473.scala:4: error: '<-' expected but '=' found. - ^ -t7473.scala:8: error: '<-' expected but '=' found. +t7473.scala:8: error: for comprehension must start with generator: '<-' expected but '=' found. (for (x = Option(i); if x == j) yield 42) toList ^ -t7473.scala:8: error: illegal start of simple expression - (for (x = Option(i); if x == j) yield 42) toList - ^ -four errors found +two errors found diff --git a/test/files/neg/t771.check b/test/files/neg/t771.check index c0d1e002f8..51b0c97f8c 100644 --- a/test/files/neg/t771.check +++ b/test/files/neg/t771.check @@ -1,4 +1,4 @@ t771.scala:4: error: trait Iterator is abstract; cannot be instantiated def c[A](it:java.util.Iterator[A]) = new scala.Iterator[A] - ^ + ^ one error found diff --git a/test/files/pos/t7854.scala b/test/files/pos/t7854.scala new file mode 100644 index 0000000000..d4de7dfe38 --- /dev/null +++ b/test/files/pos/t7854.scala @@ -0,0 +1,5 @@ +class A { + var f: Int => Unit = _ => () + + f = null +} diff --git a/test/files/run/existential-rangepos.check b/test/files/run/existential-rangepos.check index 6c4e86dedc..f426c6471f 100644 --- a/test/files/run/existential-rangepos.check +++ b/test/files/run/existential-rangepos.check @@ -5,9 +5,9 @@ [76][76][76]A.super.(); [20]() }; - [28/24:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; + [28:51]private[this] val foo: [28]Set[_ <: T] = [47:51]null; [28] def foo: [28]Set[_ <: T] = [28][28]A.this.foo; - [58/54:74] def bar: [58]Set[_ <: T] + [58:74] def bar: [58]Set[_ <: T] } } diff --git a/test/files/run/t5603.check b/test/files/run/t5603.check index 255e9356b9..46fcdd4470 100644 --- a/test/files/run/t5603.check +++ b/test/files/run/t5603.check @@ -4,18 +4,18 @@ [15]def $init$() = [15]{ [15]() }; - [27/23:39]val name: [33:39]String; - [50/46:76]val msg = [71/56:76][71/56:72][56:71]"How are you, ".$plus([72:76]name) + [27:39]val name: [33:39]String; + [50:76]val msg = [71/56:76][71/56:72][56:71]"How are you, ".$plus([72:76]name) }; [93/87:209]class C extends [94:209][151:159]Greeting { - [123/119:139]val nameElse = _; + [123:139]val nameElse = _; [95:101] private[this] val i: [98:101]Int = _; - <119:139>def ([95]i: [98]Int) = <119:139>{ - <119:139>val nameElse = <134:139>"Bob"; + <123:139>def ([95]i: [98]Int) = <123:139>{ + <123:139>val nameElse = <134:139>"Bob"; [X][X][X]super.(); [94]() }; - [172/168:184]val name = [179:184]"avc"; + [172:184]val name = [179:184]"avc"; [198/191:203][191:198]println([199:202]msg) }; [222/215:241]object Test extends [227:241][235:238]App { diff --git a/test/files/run/t6768.check b/test/files/run/t6768.check index bf4f6ea2a1..64df4568ec 100644 --- a/test/files/run/t6768.check +++ b/test/files/run/t6768.check @@ -6,7 +6,7 @@ [9]() }; [17/13:31]def f1: [17]Some[String] = [26/22:31][22:26][22:26]scala.Some.apply[[22]String]([27:30]"a"); - [38/34:56]def f2: [38]Some[String] = [43:56][43/47:51][43/47:51]new [47:51]([52:55]"b") + [38/34:56]def f2: [38]Some[String] = [47/43:56][47:51][47:51]new [47:51]([52:55]"b") } } -- cgit v1.2.3