diff options
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/constrs.check | 2 | ||||
-rw-r--r-- | test/files/neg/nowarnDefaultJunitMethods.check | 6 | ||||
-rw-r--r-- | test/files/neg/nowarnDefaultJunitMethods.flags | 1 | ||||
-rw-r--r-- | test/files/neg/nowarnDefaultJunitMethods/C_1.scala | 5 | ||||
-rw-r--r-- | test/files/neg/nowarnDefaultJunitMethods/Test.java | 3 | ||||
-rw-r--r-- | test/files/neg/saferJavaConversions.scala | 6 | ||||
-rw-r--r-- | test/files/neg/t4460a.check | 2 | ||||
-rw-r--r-- | test/files/neg/t4460b.check | 2 | ||||
-rw-r--r-- | test/files/neg/t4749.check | 2 | ||||
-rw-r--r-- | test/files/neg/t5148.check | 16 | ||||
-rw-r--r-- | test/files/neg/t5148.scala | 4 | ||||
-rw-r--r-- | test/files/neg/t5580b.scala | 2 | ||||
-rw-r--r-- | test/files/neg/t9045.check | 7 | ||||
-rw-r--r-- | test/files/neg/t9045.scala | 8 | ||||
-rw-r--r-- | test/files/neg/t9361.check | 11 | ||||
-rw-r--r-- | test/files/neg/t9361.scala | 5 | ||||
-rw-r--r-- | test/files/neg/t9684.check | 9 | ||||
-rw-r--r-- | test/files/neg/t9684.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t9684.scala | 9 | ||||
-rw-r--r-- | test/files/neg/t9684b.check | 7 | ||||
-rw-r--r-- | test/files/neg/t9684b.scala | 14 |
21 files changed, 94 insertions, 28 deletions
diff --git a/test/files/neg/constrs.check b/test/files/neg/constrs.check index 4f4a12bc13..8a5bd97ae3 100644 --- a/test/files/neg/constrs.check +++ b/test/files/neg/constrs.check @@ -7,7 +7,7 @@ constrs.scala:6: error: value u is not a member of object test constrs.scala:10: error: called constructor's definition must precede calling constructor's definition def this() = this("abc") ^ -constrs.scala:12: error: called constructor's definition must precede calling constructor's definition +constrs.scala:12: error: constructor invokes itself def this(x: Boolean) = this(x) ^ constrs.scala:16: error: type mismatch; diff --git a/test/files/neg/nowarnDefaultJunitMethods.check b/test/files/neg/nowarnDefaultJunitMethods.check new file mode 100644 index 0000000000..7efdcc299a --- /dev/null +++ b/test/files/neg/nowarnDefaultJunitMethods.check @@ -0,0 +1,6 @@ +C_1.scala:2: warning: JUnit tests in traits that are compiled as default methods are not executed by JUnit 4. JUnit 5 will fix this issue. + @org.junit.Test def foo = 0 + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/nowarnDefaultJunitMethods.flags b/test/files/neg/nowarnDefaultJunitMethods.flags new file mode 100644 index 0000000000..85d8eb2ba2 --- /dev/null +++ b/test/files/neg/nowarnDefaultJunitMethods.flags @@ -0,0 +1 @@ +-Xfatal-warnings diff --git a/test/files/neg/nowarnDefaultJunitMethods/C_1.scala b/test/files/neg/nowarnDefaultJunitMethods/C_1.scala new file mode 100644 index 0000000000..e2565a48bc --- /dev/null +++ b/test/files/neg/nowarnDefaultJunitMethods/C_1.scala @@ -0,0 +1,5 @@ +trait T { + @org.junit.Test def foo = 0 +} + +class C extends T diff --git a/test/files/neg/nowarnDefaultJunitMethods/Test.java b/test/files/neg/nowarnDefaultJunitMethods/Test.java new file mode 100644 index 0000000000..e8d64c2cc8 --- /dev/null +++ b/test/files/neg/nowarnDefaultJunitMethods/Test.java @@ -0,0 +1,3 @@ +package org.junit; + +public @interface Test { } diff --git a/test/files/neg/saferJavaConversions.scala b/test/files/neg/saferJavaConversions.scala index f0611204e6..b70a918404 100644 --- a/test/files/neg/saferJavaConversions.scala +++ b/test/files/neg/saferJavaConversions.scala @@ -3,17 +3,17 @@ case class Foo(s: String) object Test { def f1 = { - import scala.collection.JavaConversions._ + import scala.collection.convert.ImplicitConversions._ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b") val v = map.get("a") // should be a type error, actually returns null } def f2 = { - import scala.collection.convert.wrapAsScala._ + import scala.collection.convert.ImplicitConversionsToScala._ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b") val v = map.get("a") // now this is a type error } def f3 = { - import scala.collection.convert.wrapAsJava._ + import scala.collection.convert.ImplicitConversionsToJava._ val map: Map[Foo, String] = Map(Foo("a") -> "a", Foo("b") -> "b") val v = map.get("a") } diff --git a/test/files/neg/t4460a.check b/test/files/neg/t4460a.check index b711e7acb1..7a7618a114 100644 --- a/test/files/neg/t4460a.check +++ b/test/files/neg/t4460a.check @@ -1,4 +1,4 @@ -t4460a.scala:6: error: called constructor's definition must precede calling constructor's definition +t4460a.scala:6: error: constructor invokes itself def this() = this() // was binding to Predef.<init> !! ^ one error found diff --git a/test/files/neg/t4460b.check b/test/files/neg/t4460b.check index f0e703fd10..9a621dbd5c 100644 --- a/test/files/neg/t4460b.check +++ b/test/files/neg/t4460b.check @@ -1,4 +1,4 @@ -t4460b.scala:7: error: called constructor's definition must precede calling constructor's definition +t4460b.scala:7: error: constructor invokes itself def this() = this() // was binding to Predef.<init> !! ^ one error found diff --git a/test/files/neg/t4749.check b/test/files/neg/t4749.check index 3539140954..6bd2550097 100644 --- a/test/files/neg/t4749.check +++ b/test/files/neg/t4749.check @@ -26,7 +26,7 @@ t4749.scala:26: warning: Fail6 has a main method with parameter type Array[Strin object Fail6 { ^ t4749.scala:42: warning: Win3 has a main method with parameter type Array[String], but bippy.Win3 will not be a runnable program. - Reason: main method must have exact signature (Array[String])Unit + Reason: main methods cannot refer to type parameters or abstract types. object Win3 extends WinBippy[Unit] { } ^ error: No warnings can be incurred under -Xfatal-warnings. diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check deleted file mode 100644 index 1f58c235ce..0000000000 --- a/test/files/neg/t5148.check +++ /dev/null @@ -1,16 +0,0 @@ -error: missing or invalid dependency detected while loading class file 'Imports.class'. -Could not access term memberHandlers in class scala.tools.nsc.interpreter.IMain, -because it (or its dependencies) are missing. Check your build definition for -missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) -A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain. -error: missing or invalid dependency detected while loading class file 'Imports.class'. -Could not access type Wrapper in class scala.tools.nsc.interpreter.IMain.Request, -because it (or its dependencies) are missing. Check your build definition for -missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) -A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain.Request. -error: missing or invalid dependency detected while loading class file 'Imports.class'. -Could not access type Request in class scala.tools.nsc.interpreter.IMain, -because it (or its dependencies) are missing. Check your build definition for -missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) -A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain. -three errors found diff --git a/test/files/neg/t5148.scala b/test/files/neg/t5148.scala deleted file mode 100644 index fca64e57df..0000000000 --- a/test/files/neg/t5148.scala +++ /dev/null @@ -1,4 +0,0 @@ -package scala.tools.nsc -package interpreter - -class IMain extends Imports diff --git a/test/files/neg/t5580b.scala b/test/files/neg/t5580b.scala index 2161da4584..98b493e803 100644 --- a/test/files/neg/t5580b.scala +++ b/test/files/neg/t5580b.scala @@ -1,5 +1,5 @@ import scala.collection.mutable.WeakHashMap -import scala.collection.JavaConversions._ +import scala.collection.JavaConverters._ class bar { } diff --git a/test/files/neg/t9045.check b/test/files/neg/t9045.check new file mode 100644 index 0000000000..07d0e2dd74 --- /dev/null +++ b/test/files/neg/t9045.check @@ -0,0 +1,7 @@ +t9045.scala:3: error: constructor invokes itself + def this(axes: Array[Int]) = this(axes) + ^ +t9045.scala:6: error: called constructor's definition must precede calling constructor's definition + def this(d: Double) = this(d.toLong) + ^ +two errors found diff --git a/test/files/neg/t9045.scala b/test/files/neg/t9045.scala new file mode 100644 index 0000000000..e6710ab324 --- /dev/null +++ b/test/files/neg/t9045.scala @@ -0,0 +1,8 @@ + +case class AffineImageShape(axes: Seq[Int]) { + def this(axes: Array[Int]) = this(axes) +} +class X(i: Int) { + def this(d: Double) = this(d.toLong) + def this(n: Long) = this(n.toInt) +} diff --git a/test/files/neg/t9361.check b/test/files/neg/t9361.check new file mode 100644 index 0000000000..847d137f7d --- /dev/null +++ b/test/files/neg/t9361.check @@ -0,0 +1,11 @@ +t9361.scala:4: error: type mismatch; + found : Tc[_$2] where type _$2 + required: Nothing[] + new Foo { def tc = null.asInstanceOf[Tc[_]] } + ^ +t9361.scala:4: error: type mismatch; + found : Foo[Nothing] + required: Foo[Tc]{type T = Nothing} + new Foo { def tc = null.asInstanceOf[Tc[_]] } + ^ +two errors found diff --git a/test/files/neg/t9361.scala b/test/files/neg/t9361.scala new file mode 100644 index 0000000000..b689461e4d --- /dev/null +++ b/test/files/neg/t9361.scala @@ -0,0 +1,5 @@ +abstract class Foo[Tc[_]] { def tc: Tc[_] } +object Foo { + def foo[Tc[_]](): Foo[Tc] { type T = Nothing } = + new Foo { def tc = null.asInstanceOf[Tc[_]] } +} diff --git a/test/files/neg/t9684.check b/test/files/neg/t9684.check new file mode 100644 index 0000000000..833ca3341a --- /dev/null +++ b/test/files/neg/t9684.check @@ -0,0 +1,9 @@ +t9684.scala:6: warning: object JavaConversions in package collection is deprecated: Use JavaConverters + null.asInstanceOf[java.util.List[Int]] : Buffer[Int] + ^ +t9684.scala:8: warning: object JavaConversions in package collection is deprecated: Use JavaConverters + null.asInstanceOf[Iterable[Int]] : java.util.Collection[Int] + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t9684.flags b/test/files/neg/t9684.flags new file mode 100644 index 0000000000..c6bfaf1f64 --- /dev/null +++ b/test/files/neg/t9684.flags @@ -0,0 +1 @@ +-deprecation -Xfatal-warnings diff --git a/test/files/neg/t9684.scala b/test/files/neg/t9684.scala new file mode 100644 index 0000000000..f7ece269e6 --- /dev/null +++ b/test/files/neg/t9684.scala @@ -0,0 +1,9 @@ + +import scala.collection.JavaConversions._ +import scala.collection.mutable.Buffer + +trait Test { + null.asInstanceOf[java.util.List[Int]] : Buffer[Int] + + null.asInstanceOf[Iterable[Int]] : java.util.Collection[Int] +} diff --git a/test/files/neg/t9684b.check b/test/files/neg/t9684b.check new file mode 100644 index 0000000000..5f328abd43 --- /dev/null +++ b/test/files/neg/t9684b.check @@ -0,0 +1,7 @@ +t9684b.scala:6: error: reference to asScalaIterator is ambiguous; +it is imported twice in the same scope by +import scala.collection.JavaConversions._ +and import scala.collection.JavaConverters._ + asScalaIterator(null) // fails: asScalaIterator is imported twice. + ^ +one error found diff --git a/test/files/neg/t9684b.scala b/test/files/neg/t9684b.scala new file mode 100644 index 0000000000..010e9d1b5d --- /dev/null +++ b/test/files/neg/t9684b.scala @@ -0,0 +1,14 @@ +trait T1 { + import scala.collection.JavaConverters._ + import scala.collection.JavaConversions._ + + null.asInstanceOf[java.util.Iterator[String]]: Iterator[String] // works + asScalaIterator(null) // fails: asScalaIterator is imported twice. +} + +trait T2 { + import scala.collection.JavaConversions.asScalaIterator + + null.asInstanceOf[java.util.Iterator[String]]: Iterator[String] // works + asScalaIterator(null) // works +} |