diff options
Diffstat (limited to 'tests/neg')
-rw-r--r-- | tests/neg/Main.scala | 4 | ||||
-rw-r--r-- | tests/neg/compExceptions/structural.scala (renamed from tests/neg/structural.scala) | 0 | ||||
-rw-r--r-- | tests/neg/customArgs/i1050.scala (renamed from tests/neg/i1050.scala) | 0 | ||||
-rw-r--r-- | tests/neg/customArgs/overrideClass.scala (renamed from tests/neg/overrideClass.scala) | 0 | ||||
-rw-r--r-- | tests/neg/customArgs/typers.scala (renamed from tests/neg/typers.scala) | 0 | ||||
-rw-r--r-- | tests/neg/i827.scala | 4 | ||||
-rw-r--r-- | tests/neg/implicitDefs.scala | 6 | ||||
-rw-r--r-- | tests/neg/patternUnsoundness.scala | 17 | ||||
-rw-r--r-- | tests/neg/t1164.scala | 29 | ||||
-rw-r--r-- | tests/neg/t1292.scala | 4 | ||||
-rw-r--r-- | tests/neg/t7278.scala | 6 |
11 files changed, 12 insertions, 58 deletions
diff --git a/tests/neg/Main.scala b/tests/neg/Main.scala index 2cc7ad50e..24a94d654 100644 --- a/tests/neg/Main.scala +++ b/tests/neg/Main.scala @@ -17,7 +17,7 @@ object Main extends Driver { override def newCompiler(): Compiler = new Compiler override def doCompile(compiler: Compiler, fileNames: List[String])(implicit ctx: Context): Unit = { - if (new config.Settings.Setting.SettingDecorator(ctx.base.settings.resident).value) resident(compiler) - else super.doCompile(compiler,123) + if (new config.Settings.Setting.SettingDecorator(ctx.base.settings.resident).value) resident(compiler) // error + else super.doCompile(compiler,123) // error: type mismatch } } diff --git a/tests/neg/structural.scala b/tests/neg/compExceptions/structural.scala index 1d2506290..1d2506290 100644 --- a/tests/neg/structural.scala +++ b/tests/neg/compExceptions/structural.scala diff --git a/tests/neg/i1050.scala b/tests/neg/customArgs/i1050.scala index 1ade1366a..1ade1366a 100644 --- a/tests/neg/i1050.scala +++ b/tests/neg/customArgs/i1050.scala diff --git a/tests/neg/overrideClass.scala b/tests/neg/customArgs/overrideClass.scala index 803d97dd9..803d97dd9 100644 --- a/tests/neg/overrideClass.scala +++ b/tests/neg/customArgs/overrideClass.scala diff --git a/tests/neg/typers.scala b/tests/neg/customArgs/typers.scala index 49742ebbd..49742ebbd 100644 --- a/tests/neg/typers.scala +++ b/tests/neg/customArgs/typers.scala diff --git a/tests/neg/i827.scala b/tests/neg/i827.scala index cc795b590..182ffe0b1 100644 --- a/tests/neg/i827.scala +++ b/tests/neg/i827.scala @@ -1,7 +1,7 @@ trait A { trait Inner } trait B { self: A => - trait Inner extends self.Inner + trait Inner extends self.Inner // error: cannot merge trait Inner in trait A with trait Inner in trait B as members of type (A & B)(B.this) } -class C extends C +class C extends C // error: cyclic inheritance: class C extends itself diff --git a/tests/neg/implicitDefs.scala b/tests/neg/implicitDefs.scala index 28ac32656..1489344c8 100644 --- a/tests/neg/implicitDefs.scala +++ b/tests/neg/implicitDefs.scala @@ -5,7 +5,7 @@ import Predef.{any2stringadd => _, StringAdd => _, _} object implicitDefs { - implicit val x = 2 - implicit def y(x: Int) = 3 - implicit def z(a: x.type): String = "" + implicit val x = 2 // error: type of implicit definition needs to be given explicitly + implicit def y(x: Int) = 3 // error: result type of implicit definition needs to be given explicitly + implicit def z(a: x.type): String = "" // error: implicit conversion may not have a parameter of singleton type } diff --git a/tests/neg/patternUnsoundness.scala b/tests/neg/patternUnsoundness.scala deleted file mode 100644 index 4620f6c7d..000000000 --- a/tests/neg/patternUnsoundness.scala +++ /dev/null @@ -1,17 +0,0 @@ -object patternUnsoundness extends App { - - class C[+T] - - case class D[S](_s: S) extends C[S] { - var s: S = _s - } - - val x = new D[String]("abc") - val y: C[Object] = x - - y match { - case d @ D(x) => d.s = new Integer(1) - } - - val z: String = x.s // ClassCast exception -} diff --git a/tests/neg/t1164.scala b/tests/neg/t1164.scala deleted file mode 100644 index 7775b5e86..000000000 --- a/tests/neg/t1164.scala +++ /dev/null @@ -1,29 +0,0 @@ -object test { - - class Foo[a](val arg : a) - - object Foo { - def apply [a](arg : a, right :a) = new Foo[a](arg) - def unapply [a](m : Foo[a]) = Some (m.arg) - } - - def matchAndGetArgFromFoo[a]( e:Foo[a]):a = {e match { case Foo(x) => x }} - // Unapply node here will have type argument [a] instantiated to scala.Nothing: - // UnApply(TypeApply(Select(Ident(Foo),unapply),List(TypeTree[TypeVar(PolyParam(a) -> TypeRef(ThisType(TypeRef(NoPrefix,scala)),Nothing))])),List(),List(Bind(x,Ident(_)))) - // but the type of the UnApply node itself is correct: RefinedType(TypeRef(ThisType(TypeRef(ThisType(TypeRef(NoPrefix,<empty>)),test$)),Foo), test$$Foo$$a, TypeAlias(TypeRef(NoPrefix,a))) - // - - - // Try the same thing as above but use function as argument to Bar - // constructor - - type FunIntToA [a] = (Int) => a - class Bar[a] (var f: FunIntToA[a]) - - object Bar { - def apply[a](f: FunIntToA[a]) = new Bar[a](f) - def unapply[a](m: Bar[a]) = Some (m.f) - } - - def matchAndGetFunFromBar[a](b:Bar[a]) : FunIntToA[a] = { b match { case Bar(x) => x}} -} diff --git a/tests/neg/t1292.scala b/tests/neg/t1292.scala index 69e680320..de74dc159 100644 --- a/tests/neg/t1292.scala +++ b/tests/neg/t1292.scala @@ -1,5 +1,5 @@ trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] { - type StV = Enum#Value + type StV = Enum#Value // error: Enum is not a legal path type Meta = MegaFoo[T, Enum] type Slog <: Enumeration @@ -9,7 +9,7 @@ trait Foo[T <: Foo[T, Enum], Enum <: Enumeration] { trait MegaFoo[T <: Foo[T, Enum], Enum <: Enumeration] extends Foo[T, Enum] { def doSomething(what: T, misc: StV, dog: Meta#Event) = None - // error: Meta is not a valid prefix for '#'. + // old-error: Meta is not a valid prefix for '#'. // The error is correct. Meta is not stable, and it has an abstract type member Slog abstract class Event object Event diff --git a/tests/neg/t7278.scala b/tests/neg/t7278.scala index 9a8292409..7aafbb76f 100644 --- a/tests/neg/t7278.scala +++ b/tests/neg/t7278.scala @@ -8,13 +8,13 @@ object Test { // should not compile (?) // martin says "I'd argue about that" // martin retracts his statement: this should not compile - type EE[+X <: EC] = X#E - type EE2[+X <: EC] = X#E // repeat to get error count to 2 + type EE[+X <: EC] = X#E // error: X is not a legal path; + type EE2[+X <: EC] = X#E // error: X is not a legal path; repeat to get error count to 2 def fail1(): Unit = { val b = new B var x1: EE[A] = null - var x2: EE[B] = new b.E // error: found: B#E, required: A#E + var x2: EE[B] = new b.E // old-error: found: B#E, required: A#E // x1 = x2 // gives a prior type error: B#E, required: A#E, masked to get at the real thing. } |