diff options
Diffstat (limited to 'test/files/neg')
35 files changed, 191 insertions, 66 deletions
diff --git a/test/files/neg/logImplicits.check b/test/files/neg/logImplicits.check index df7b359767..479bf4ba2c 100644 --- a/test/files/neg/logImplicits.check +++ b/test/files/neg/logImplicits.check @@ -4,7 +4,7 @@ logImplicits.scala:2: applied implicit conversion from xs.type to ?{def size: ?} logImplicits.scala:7: applied implicit conversion from String("abc") to ?{def map: ?} = implicit def augmentString(x: String): scala.collection.immutable.StringOps def f = "abc" map (_ + 1) ^ -logImplicits.scala:15: inferred view from String("abc") to Int = C.this.convert:(p: String)Int +logImplicits.scala:15: inferred view from String("abc") to Int via C.this.convert: (p: String)Int math.max(122, x: Int) ^ logImplicits.scala:19: applied implicit conversion from Int(1) to ?{def ->: ?} = implicit def ArrowAssoc[A](self: A): ArrowAssoc[A] diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check index 8a6aafd67a..875bc2ade0 100644 --- a/test/files/neg/names-defaults-neg.check +++ b/test/files/neg/names-defaults-neg.check @@ -130,7 +130,7 @@ names-defaults-neg.scala:102: error: unknown parameter name: m names-defaults-neg.scala:135: error: reference to var2 is ambiguous; it is both a method parameter and a variable in scope. delay(var2 = 40) ^ -names-defaults-neg.scala:138: error: missing parameter type for expanded function ((x$1) => a = x$1) +names-defaults-neg.scala:138: error: missing parameter type for expanded function ((x$1: <error>) => a = x$1) val taf2: Int => Unit = testAnnFun(a = _, b = get("+")) ^ names-defaults-neg.scala:138: error: not found: value a @@ -142,10 +142,10 @@ names-defaults-neg.scala:138: error: not found: value get names-defaults-neg.scala:139: error: parameter 'a' is already specified at parameter position 1 val taf3 = testAnnFun(b = _: String, a = get(8)) ^ -names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$3) => testAnnFun(x$3, ((x$4) => b = x$4))) +names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$3: <error>) => testAnnFun(x$3, ((x$4) => b = x$4))) val taf4: (Int, String) => Unit = testAnnFun(_, b = _) ^ -names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$4) => b = x$4) +names-defaults-neg.scala:140: error: missing parameter type for expanded function ((x$4: <error>) => b = x$4) val taf4: (Int, String) => Unit = testAnnFun(_, b = _) ^ names-defaults-neg.scala:140: error: not found: value b 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/sammy_disabled.check b/test/files/neg/sammy_disabled.check new file mode 100644 index 0000000000..66db9dd5f2 --- /dev/null +++ b/test/files/neg/sammy_disabled.check @@ -0,0 +1,4 @@ +sammy_disabled.scala:3: error: missing parameter type +class C { val f: F = x => "a" } + ^ +one error found diff --git a/test/files/neg/sammy_disabled.flags b/test/files/neg/sammy_disabled.flags new file mode 100644 index 0000000000..cf42e9f940 --- /dev/null +++ b/test/files/neg/sammy_disabled.flags @@ -0,0 +1 @@ +-Xsource:2.11 diff --git a/test/files/neg/sammy_disabled.scala b/test/files/neg/sammy_disabled.scala new file mode 100644 index 0000000000..12000a3e12 --- /dev/null +++ b/test/files/neg/sammy_disabled.scala @@ -0,0 +1,3 @@ +trait F { def apply(x: Int): String } + +class C { val f: F = x => "a" } diff --git a/test/files/neg/sammy_error.check b/test/files/neg/sammy_error.check new file mode 100644 index 0000000000..f14ac7e3a2 --- /dev/null +++ b/test/files/neg/sammy_error.check @@ -0,0 +1,4 @@ +sammy_error.scala:6: error: missing parameter type + foo(x => x) // should result in only one error (the second one stemmed from adapting to SAM when the tree was erroneous) + ^ +one error found diff --git a/test/files/neg/sammy_error.scala b/test/files/neg/sammy_error.scala new file mode 100644 index 0000000000..dbddebf325 --- /dev/null +++ b/test/files/neg/sammy_error.scala @@ -0,0 +1,7 @@ +trait F1[A, B] { def apply(a: A): B } + +class Test { + def foo[A](f1: F1[A, A]) = f1 + + foo(x => x) // should result in only one error (the second one stemmed from adapting to SAM when the tree was erroneous) +} diff --git a/test/files/neg/sammy_error_exist_no_crash.check b/test/files/neg/sammy_error_exist_no_crash.check index a0d2237ce0..944b6471fd 100644 --- a/test/files/neg/sammy_error_exist_no_crash.check +++ b/test/files/neg/sammy_error_exist_no_crash.check @@ -1,6 +1,4 @@ -sammy_error_exist_no_crash.scala:5: error: Could not derive subclass of F[? >: String] - (with SAM `def method apply(s: String)Int`) - based on: ((x$1: String) => x$1.<parseInt: error>). +sammy_error_exist_no_crash.scala:5: error: value parseInt is not a member of String bar(_.parseInt) ^ one error found diff --git a/test/files/neg/sammy_error_exist_no_crash.flags b/test/files/neg/sammy_error_exist_no_crash.flags deleted file mode 100644 index e1b37447c9..0000000000 --- a/test/files/neg/sammy_error_exist_no_crash.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental
\ No newline at end of file diff --git a/test/files/neg/sammy_error_exist_no_crash.scala b/test/files/neg/sammy_error_exist_no_crash.scala index da7e47206f..667b4db763 100644 --- a/test/files/neg/sammy_error_exist_no_crash.scala +++ b/test/files/neg/sammy_error_exist_no_crash.scala @@ -1,6 +1,6 @@ -abstract class F[T] { def apply(s: T): Int } +trait F[T] { def apply(s: T): Int } object NeedsNiceError { def bar(x: F[_ >: String]) = ??? bar(_.parseInt) -}
\ No newline at end of file +} diff --git a/test/files/neg/sammy_expected.check b/test/files/neg/sammy_expected.check new file mode 100644 index 0000000000..3b76aabdd2 --- /dev/null +++ b/test/files/neg/sammy_expected.check @@ -0,0 +1,6 @@ +sammy_expected.scala:4: error: type mismatch; + found : String => Int + required: F[Object,Int] + def wrong: F[Object, Int] = (x: String) => 1 + ^ +one error found diff --git a/test/files/neg/sammy_expected.scala b/test/files/neg/sammy_expected.scala new file mode 100644 index 0000000000..8fc1f66ff7 --- /dev/null +++ b/test/files/neg/sammy_expected.scala @@ -0,0 +1,5 @@ +trait F[A, B] { def apply(x: A): B } + +class MustMeetExpected { + def wrong: F[Object, Int] = (x: String) => 1 +}
\ No newline at end of file diff --git a/test/files/neg/sammy_overload.check b/test/files/neg/sammy_overload.check new file mode 100644 index 0000000000..903d7c88f4 --- /dev/null +++ b/test/files/neg/sammy_overload.check @@ -0,0 +1,7 @@ +sammy_overload.scala:11: error: missing parameter type for expanded function ((x$1: <error>) => x$1.toString) + O.m(_.toString) // error expected: eta-conversion breaks down due to overloading + ^ +sammy_overload.scala:12: error: missing parameter type + O.m(x => x) // error expected: needs param type + ^ +two errors found diff --git a/test/files/neg/sammy_overload.scala b/test/files/neg/sammy_overload.scala new file mode 100644 index 0000000000..91c52cf96c --- /dev/null +++ b/test/files/neg/sammy_overload.scala @@ -0,0 +1,13 @@ +trait ToString { def convert(x: Int): String } + +class ExplicitSamType { + object O { + def m(x: Int => String): Int = 0 + def m(x: ToString): Int = 1 + } + + O.m((x: Int) => x.toString) // ok, function type takes precedence + + O.m(_.toString) // error expected: eta-conversion breaks down due to overloading + O.m(x => x) // error expected: needs param type +} diff --git a/test/files/neg/sammy_restrictions.check b/test/files/neg/sammy_restrictions.check index 8cc49f9aa9..09579cbe21 100644 --- a/test/files/neg/sammy_restrictions.check +++ b/test/files/neg/sammy_restrictions.check @@ -1,26 +1,18 @@ -sammy_restrictions.scala:31: error: type mismatch; +sammy_restrictions.scala:35: error: type mismatch; found : () => Int required: NoAbstract (() => 0) : NoAbstract ^ -sammy_restrictions.scala:32: error: type mismatch; +sammy_restrictions.scala:36: error: type mismatch; found : Int => Int required: TwoAbstract ((x: Int) => 0): TwoAbstract ^ -sammy_restrictions.scala:34: error: class type required but DerivedOneAbstract with OneAbstract found - ((x: Int) => 0): NonClassType // "class type required". I think we should avoid SAM translation here. - ^ -sammy_restrictions.scala:35: error: type mismatch; +sammy_restrictions.scala:37: error: type mismatch; found : Int => Int required: NoEmptyConstructor ((x: Int) => 0): NoEmptyConstructor ^ -sammy_restrictions.scala:37: error: type mismatch; - found : Int => Int - required: OneEmptySecondaryConstructor - ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. - ^ sammy_restrictions.scala:38: error: type mismatch; found : Int => Int required: MultipleConstructorLists @@ -28,22 +20,32 @@ sammy_restrictions.scala:38: error: type mismatch; ^ sammy_restrictions.scala:39: error: type mismatch; found : Int => Int + required: OneEmptySecondaryConstructor + ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. + ^ +sammy_restrictions.scala:40: error: type mismatch; + found : Int => Int required: MultipleMethodLists ((x: Int) => 0): MultipleMethodLists ^ -sammy_restrictions.scala:40: error: type mismatch; +sammy_restrictions.scala:41: error: type mismatch; found : Int => Int required: ImplicitConstructorParam ((x: Int) => 0): ImplicitConstructorParam ^ -sammy_restrictions.scala:41: error: type mismatch; +sammy_restrictions.scala:42: error: type mismatch; found : Int => Int required: ImplicitMethodParam ((x: Int) => 0): ImplicitMethodParam ^ -sammy_restrictions.scala:44: error: type mismatch; +sammy_restrictions.scala:43: error: type mismatch; found : Int => Int required: PolyMethod ((x: Int) => 0): PolyMethod ^ +sammy_restrictions.scala:44: error: type mismatch; + found : Int => Int + required: SelfTp + ((x: Int) => 0): SelfTp + ^ 10 errors found diff --git a/test/files/neg/sammy_restrictions.flags b/test/files/neg/sammy_restrictions.flags deleted file mode 100644 index 48fd867160..0000000000 --- a/test/files/neg/sammy_restrictions.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental diff --git a/test/files/neg/sammy_restrictions.scala b/test/files/neg/sammy_restrictions.scala index d003cfaf36..ff2c16b679 100644 --- a/test/files/neg/sammy_restrictions.scala +++ b/test/files/neg/sammy_restrictions.scala @@ -24,22 +24,29 @@ abstract class PolyMethod { def ap[T](a: T): T } abstract class OneAbstract { def ap(a: Int): Any } abstract class DerivedOneAbstract extends OneAbstract +abstract class SelfTp { self: NoAbstract => def ap(a: Int): Any } +abstract class SelfVar { self => def ap(a: Int): Any } + object Test { implicit val s: String = "" type NonClassType = DerivedOneAbstract with OneAbstract + // errors: (() => 0) : NoAbstract ((x: Int) => 0): TwoAbstract - ((x: Int) => 0): DerivedOneAbstract // okay - ((x: Int) => 0): NonClassType // "class type required". I think we should avoid SAM translation here. ((x: Int) => 0): NoEmptyConstructor - ((x: Int) => 0): OneEmptyConstructor // okay - ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. ((x: Int) => 0): MultipleConstructorLists + ((x: Int) => 0): OneEmptySecondaryConstructor // derived class must have an empty *primary* to call. ((x: Int) => 0): MultipleMethodLists ((x: Int) => 0): ImplicitConstructorParam ((x: Int) => 0): ImplicitMethodParam - - ((x: Int) => 0): PolyClass[Int] // okay ((x: Int) => 0): PolyMethod + ((x: Int) => 0): SelfTp + + // allowed: + ((x: Int) => 0): OneEmptyConstructor + ((x: Int) => 0): DerivedOneAbstract + ((x: Int) => 0): NonClassType // we also allow type aliases in instantiation expressions, if they resolve to a class type + ((x: Int) => 0): PolyClass[Int] + ((x: Int) => 0): SelfVar } diff --git a/test/files/neg/sammy_wrong_arity.flags b/test/files/neg/sammy_wrong_arity.flags deleted file mode 100644 index 48fd867160..0000000000 --- a/test/files/neg/sammy_wrong_arity.flags +++ /dev/null @@ -1 +0,0 @@ --Xexperimental 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 286ed9e04a..0000000000 --- a/test/files/neg/t5148.check +++ /dev/null @@ -1,11 +0,0 @@ -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. -two 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/t5761.check b/test/files/neg/t5761.check index 2d66af26f6..15c0bc7634 100644 --- a/test/files/neg/t5761.check +++ b/test/files/neg/t5761.check @@ -13,7 +13,7 @@ Unspecified value parameter x. t5761.scala:13: error: not found: type Tread new Tread("sth") { }.run() ^ -t5761.scala:13: error: value run is not a member of AnyRef +t5761.scala:13: error: value run is not a member of <error> new Tread("sth") { }.run() ^ 5 errors found diff --git a/test/files/neg/t7848-interp-warn.check b/test/files/neg/t7848-interp-warn.check index 637fc8941a..cc94cc81de 100644 --- a/test/files/neg/t7848-interp-warn.check +++ b/test/files/neg/t7848-interp-warn.check @@ -1,15 +1,27 @@ -t7848-interp-warn.scala:8: warning: possible missing interpolator: detected interpolated identifier `$foo` - "An important $foo message!" +t7848-interp-warn.scala:18: warning: possible missing interpolator: detected interpolated identifier `$foo` + "An important $foo message!" // warn on ident in scope ^ -t7848-interp-warn.scala:12: warning: possible missing interpolator: detected an interpolated expression - "A doubly important ${foo * 2} message!" +t7848-interp-warn.scala:22: warning: possible missing interpolator: detected an interpolated expression + "A doubly important ${foo * 2} message!" // warn on some expr, see below ^ -t7848-interp-warn.scala:15: warning: possible missing interpolator: detected interpolated identifier `$bar` - def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test +t7848-interp-warn.scala:25: warning: possible missing interpolator: detected interpolated identifier `$bar` + def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test ^ -t7848-interp-warn.scala:16: warning: possible missing interpolator: detected interpolated identifier `$bar` +t7848-interp-warn.scala:26: warning: possible missing interpolator: detected interpolated identifier `$bar` def j = s"Try using '${ "something like $bar" }' instead." // warn ^ +t7848-interp-warn.scala:32: warning: possible missing interpolator: detected an interpolated expression + def v = "${baz}${bar}" // warn on second expr + ^ +t7848-interp-warn.scala:33: warning: possible missing interpolator: detected an interpolated expression + def w = "${ op_* }" // warn, only cheap ident parsing + ^ +t7848-interp-warn.scala:34: warning: possible missing interpolator: detected an interpolated expression + def x = "${ bar }" // warn, a cheap ident in scope + ^ +t7848-interp-warn.scala:36: warning: possible missing interpolator: detected an interpolated expression + def z = "${ baz * 3}" // warn, no expr parsing + ^ error: No warnings can be incurred under -Xfatal-warnings. -four warnings found +8 warnings found one error found diff --git a/test/files/neg/t7848-interp-warn.scala b/test/files/neg/t7848-interp-warn.scala index a76141041d..ceaf6c7d67 100644 --- a/test/files/neg/t7848-interp-warn.scala +++ b/test/files/neg/t7848-interp-warn.scala @@ -1,18 +1,37 @@ package test +package pancake { } + object Test { + type NonVal = Int + + def ok = "Don't warn on $nosymbol interpolated." + + def pass = "Don't warn on $pancake package names." + + def types = "Or $NonVal type symbols either." + def bar = "bar" def f = { val foo = "bar" - "An important $foo message!" + "An important $foo message!" // warn on ident in scope } def g = { val foo = "bar" - "A doubly important ${foo * 2} message!" + "A doubly important ${foo * 2} message!" // warn on some expr, see below } - def h = s"Try using '$$bar' instead." // no warn - def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test + def h = s"Try using '$$bar' instead." // no warn + def i = s"Try using '${ "$bar" }' instead." // was: no warn on space test def j = s"Try using '${ "something like $bar" }' instead." // warn - def k = f"Try using '$bar' instead." // no warn on other std interps + def k = f"Try using '$bar' instead." // no warn on other std interps + def p = "Template ${} {}" // no warn on unlikely or empty expressions + def q = "${}$bar" // disables subsequent checks! (a feature) + def r = "${}${bar}" // disables subsequent checks! (a feature) + + def v = "${baz}${bar}" // warn on second expr + def w = "${ op_* }" // warn, only cheap ident parsing + def x = "${ bar }" // warn, a cheap ident in scope + def y = "${ baz }" // no warn, cheap ident not in scope + def z = "${ baz * 3}" // warn, no expr parsing } 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 +} |