diff options
Diffstat (limited to 'test')
22 files changed, 90 insertions, 14 deletions
diff --git a/test/files/neg/t3240.check b/test/files/neg/t3240.check deleted file mode 100644 index efae682c66..0000000000 --- a/test/files/neg/t3240.check +++ /dev/null @@ -1,4 +0,0 @@ -t3240.scala:3: error: only classes can have declared but undefined members - type t - ^ -one error found diff --git a/test/files/neg/t8217-local-alias-requires-rhs.check b/test/files/neg/t8217-local-alias-requires-rhs.check new file mode 100644 index 0000000000..0d4f0864ba --- /dev/null +++ b/test/files/neg/t8217-local-alias-requires-rhs.check @@ -0,0 +1,10 @@ +t8217-local-alias-requires-rhs.scala:6: error: only classes can have declared but undefined members + type B + ^ +t8217-local-alias-requires-rhs.scala:3: error: only classes can have declared but undefined members + type A + ^ +t8217-local-alias-requires-rhs.scala:14: error: only classes can have declared but undefined members + def this(a: Any) = { this(); type C } + ^ +three errors found diff --git a/test/files/neg/t8217-local-alias-requires-rhs.scala b/test/files/neg/t8217-local-alias-requires-rhs.scala new file mode 100644 index 0000000000..12b7976835 --- /dev/null +++ b/test/files/neg/t8217-local-alias-requires-rhs.scala @@ -0,0 +1,15 @@ +trait Alias { + def foo = { + type A + } + val bar = { + type B + object O { + type OK + } + } +} + +class C { + def this(a: Any) = { this(); type C } +} diff --git a/test/files/neg/t845.check b/test/files/neg/t845.check deleted file mode 100644 index 07ed7e417b..0000000000 --- a/test/files/neg/t845.check +++ /dev/null @@ -1,4 +0,0 @@ -t845.scala:4: error: only classes can have declared but undefined members - type Bar; - ^ -one error found diff --git a/test/files/neg/t8869.check b/test/files/neg/t8869.check new file mode 100644 index 0000000000..40b8570f9f --- /dev/null +++ b/test/files/neg/t8869.check @@ -0,0 +1,7 @@ +t8869.scala:5: error: class Option takes type parameters + def value: TC[({type l1[x] = Option})#l1] = ??? // error not reported! + ^ +t8869.scala:7: error: class Option takes type parameters + type l2[x] = Option // error correctly reported + ^ +two errors found diff --git a/test/files/neg/t8869.scala b/test/files/neg/t8869.scala new file mode 100644 index 0000000000..0c7f0c9451 --- /dev/null +++ b/test/files/neg/t8869.scala @@ -0,0 +1,10 @@ +class TC[T[_]] { + def identity[A](a: T[A]): T[A] = a +} +object Test { + def value: TC[({type l1[x] = Option})#l1] = ??? // error not reported! + + type l2[x] = Option // error correctly reported + def value1: TC[l2] = ??? +} + diff --git a/test/files/neg/t3240.scala b/test/files/pos/t3240.scala index cf197a406d..cf197a406d 100644 --- a/test/files/neg/t3240.scala +++ b/test/files/pos/t3240.scala diff --git a/test/files/pos/t8267.scala b/test/files/pos/t8267.scala new file mode 100644 index 0000000000..37b498fe3e --- /dev/null +++ b/test/files/pos/t8267.scala @@ -0,0 +1,33 @@ +class Bippy { trait Foo[A] } + +final class RichBippy[C <: Bippy with Singleton](val c1: C) { + def f: Int = 1 + def f[A](x: A)(ev: c1.Foo[A]): Int = 2 + + def g[A <: Nothing](x: A): Int = 1 + def g[A](x: A)(ev: c1.Foo[A]): Int = 2 + + def h[A](x: A)(ev: c1.Foo[A]): Int = 1 + + def i(x: Nothing): Int = 1 + def i(x: AnyRef)(ev: c1.Foo[x.type]): Int = 2 +} + +object p { + + val c = new Bippy + val d0 = new RichBippy[c.type](c) + def d1 = new RichBippy[c.type](c) + + d0.f[Int](5)(null: c.Foo[Int]) // ok + d1.f[Int](5)(null: c.Foo[Int]) // fails + + d0.g[Int](5)(null: c.Foo[Int]) // ok + d1.g[Int](5)(null: c.Foo[Int]) // fails + + d0.h[Int](5)(null: c.Foo[Int]) // ok + d1.h[Int](5)(null: c.Foo[Int]) // ok + + d0.i("")(null) // ok + d1.i("")(null) // ok +} diff --git a/test/files/neg/t845.scala b/test/files/pos/t845.scala index ddf6a16f32..ddf6a16f32 100644 --- a/test/files/neg/t845.scala +++ b/test/files/pos/t845.scala diff --git a/test/files/run/t8087.scala b/test/files/run/t8087.scala new file mode 100644 index 0000000000..6047211756 --- /dev/null +++ b/test/files/run/t8087.scala @@ -0,0 +1,12 @@ +trait Foo { + @volatile private[this] var x: String = "" + @volatile private var y: String = "" +} + +class Bar extends Foo + +object Test extends App { + classOf[Bar].getDeclaredFields.foreach(f => { + assert(java.lang.reflect.Modifier.isVolatile(f.getModifiers), f.getName) + }) +} diff --git a/test/junit/scala/collection/PagedSeq.scala b/test/junit/scala/collection/immutable/PagedSeqTest.scala index 5f83cf6f31..5f83cf6f31 100644 --- a/test/junit/scala/collection/PagedSeq.scala +++ b/test/junit/scala/collection/immutable/PagedSeqTest.scala diff --git a/test/junit/scala/collection/QueueTest.scala b/test/junit/scala/collection/immutable/QueueTest.scala index 9a40d8fc90..9a40d8fc90 100644 --- a/test/junit/scala/collection/QueueTest.scala +++ b/test/junit/scala/collection/immutable/QueueTest.scala diff --git a/test/junit/scala/collection/NumericRangeTest.scala b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala index 3980c31577..3980c31577 100644 --- a/test/junit/scala/collection/NumericRangeTest.scala +++ b/test/junit/scala/collection/immutable/RangeConsistencyTest.scala diff --git a/test/junit/scala/collection/StreamTest.scala b/test/junit/scala/collection/immutable/StreamTest.scala index 6dc1c79a48..6dc1c79a48 100644 --- a/test/junit/scala/collection/StreamTest.scala +++ b/test/junit/scala/collection/immutable/StreamTest.scala diff --git a/test/junit/scala/collection/ArraySortingTest.scala b/test/junit/scala/collection/mutable/ArraySortingTest.scala index 4e54b39ce7..4e54b39ce7 100644 --- a/test/junit/scala/collection/ArraySortingTest.scala +++ b/test/junit/scala/collection/mutable/ArraySortingTest.scala diff --git a/test/junit/scala/collection/PriorityQueueTest.scala b/test/junit/scala/collection/mutable/PriorityQueueTest.scala index a14f1bf4c8..a14f1bf4c8 100644 --- a/test/junit/scala/collection/PriorityQueueTest.scala +++ b/test/junit/scala/collection/mutable/PriorityQueueTest.scala diff --git a/test/junit/scala/collection/VectorTest.scala b/test/junit/scala/collection/mutable/VectorTest.scala index e9c4d44a72..e9c4d44a72 100644 --- a/test/junit/scala/collection/VectorTest.scala +++ b/test/junit/scala/collection/mutable/VectorTest.scala diff --git a/test/junit/scala/math/NumericTest.scala b/test/junit/scala/math/NumericTest.scala index 4f0657f471..9bf7d4f1e4 100644 --- a/test/junit/scala/math/NumericTest.scala +++ b/test/junit/scala/math/NumericTest.scala @@ -1,4 +1,4 @@ - +package scala.math import org.junit.Assert._ import org.junit.Test diff --git a/test/junit/scala/reflect/internal/ScopeTest.scala b/test/junit/scala/reflect/internal/ScopeTest.scala index 5166620189..1ab24facac 100644 --- a/test/junit/scala/reflect/internal/ScopeTest.scala +++ b/test/junit/scala/reflect/internal/ScopeTest.scala @@ -1,4 +1,4 @@ -package symtab +package scala.reflect.internal import scala.tools.nsc.symtab diff --git a/test/junit/scala/tools/nsc/SampleTest.scala b/test/junit/scala/tools/nsc/SampleTest.scala index 8e026da1ea..810c88ef9d 100644 --- a/test/junit/scala/tools/nsc/SampleTest.scala +++ b/test/junit/scala/tools/nsc/SampleTest.scala @@ -1,5 +1,4 @@ package scala.tools.nsc -package test import org.junit.Assert._ import org.junit.Test diff --git a/test/junit/scala/util/t7265.scala b/test/junit/scala/util/SpecVersionTest.scala index 71f085d21d..e3e7a978f2 100644 --- a/test/junit/scala/util/t7265.scala +++ b/test/junit/scala/util/SpecVersionTest.scala @@ -1,14 +1,11 @@ package scala.util -package test import org.junit.Assert._ import org.junit.Test import org.junit.runner.RunWith import org.junit.runners.JUnit4 -import scala.util.PropertiesTrait - /** The java version property uses the spec version * and must work for all "major.minor" and fail otherwise. */ @@ -24,6 +21,7 @@ class SpecVersionTest { override lazy val scalaProps = new java.util.Properties } + // SI-7265 @Test def comparesCorrectly(): Unit = { assert(sut isJavaAtLeast "1.5") diff --git a/test/junit/scala/util/matching/regextract-char.scala b/test/junit/scala/util/matching/CharRegexTest.scala index 50fdcd9d46..50fdcd9d46 100644 --- a/test/junit/scala/util/matching/regextract-char.scala +++ b/test/junit/scala/util/matching/CharRegexTest.scala |