diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-08-30 00:03:48 -0700 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-08-30 00:03:48 -0700 |
commit | c60ed61f18bbc4e0b5907fc4cc726ff41dd0434b (patch) | |
tree | 0652842d15b3a2b8c9761718e6e11e258a8e3e2b /test/files/pos | |
parent | 44b178b37698fd51afa8eed95e98b9ff7d38b8ab (diff) | |
parent | a0da5a697a2a0841972907b66fa733ab3e0ca665 (diff) | |
download | scala-c60ed61f18bbc4e0b5907fc4cc726ff41dd0434b.tar.gz scala-c60ed61f18bbc4e0b5907fc4cc726ff41dd0434b.tar.bz2 scala-c60ed61f18bbc4e0b5907fc4cc726ff41dd0434b.zip |
Merge pull request #2886 from gkossakowski/merge-2.10.x
Merge 2.10.x into master
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t7014/ThreadSafety.java | 9 | ||||
-rw-r--r-- | test/files/pos/t7014/ThreadSafetyLevel.java | 8 | ||||
-rw-r--r-- | test/files/pos/t7014/t7014.scala | 4 | ||||
-rw-r--r-- | test/files/pos/t7486-named.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t7486.scala | 8 | ||||
-rw-r--r-- | test/files/pos/t7694.scala | 40 | ||||
-rw-r--r-- | test/files/pos/t7716.scala | 16 | ||||
-rw-r--r-- | test/files/pos/t942/Amount_1.java | 5 | ||||
-rw-r--r-- | test/files/pos/t942/Test_2.scala | 3 |
9 files changed, 101 insertions, 0 deletions
diff --git a/test/files/pos/t7014/ThreadSafety.java b/test/files/pos/t7014/ThreadSafety.java new file mode 100644 index 0000000000..ed508804e3 --- /dev/null +++ b/test/files/pos/t7014/ThreadSafety.java @@ -0,0 +1,9 @@ +package t7014; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) // must be exactly RUNTIME retention (those we parse) +public @interface ThreadSafety { + ThreadSafetyLevel level(); +}
\ No newline at end of file diff --git a/test/files/pos/t7014/ThreadSafetyLevel.java b/test/files/pos/t7014/ThreadSafetyLevel.java new file mode 100644 index 0000000000..4df1dc787a --- /dev/null +++ b/test/files/pos/t7014/ThreadSafetyLevel.java @@ -0,0 +1,8 @@ +package t7014; // package needed due to other bug in scalac's java parser + +// since we parse eagerly, we have not yet parsed the classfile when parsing the annotation, +// and on doing so, fail to find a symbol for the COMPLETELY_THREADSAFE reference +// from the annotation's argument to the enum's member +// for now, let's just not crash -- should implement lazy completing at some point +@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) +public enum ThreadSafetyLevel { COMPLETELY_THREADSAFE } diff --git a/test/files/pos/t7014/t7014.scala b/test/files/pos/t7014/t7014.scala new file mode 100644 index 0000000000..faec4c7740 --- /dev/null +++ b/test/files/pos/t7014/t7014.scala @@ -0,0 +1,4 @@ +package t7014 + +import ThreadSafetyLevel.COMPLETELY_THREADSAFE // refer to annotation so it gets parsed +
\ No newline at end of file diff --git a/test/files/pos/t7486-named.scala b/test/files/pos/t7486-named.scala new file mode 100644 index 0000000000..253293e5f1 --- /dev/null +++ b/test/files/pos/t7486-named.scala @@ -0,0 +1,8 @@ + +object Test { + def fold(empty: Any) = () + implicit val notAnnotatedImplicit = new { + fold(empty = 0) + def empty[A]: Any = ??? + } +} diff --git a/test/files/pos/t7486.scala b/test/files/pos/t7486.scala new file mode 100644 index 0000000000..6dd7f4c4ac --- /dev/null +++ b/test/files/pos/t7486.scala @@ -0,0 +1,8 @@ +object Test{ + var locker = 0 + // remove implicit, or change to `locker = locker + 1` to make it compile. + implicit val davyJones0 = { + locker += 0 + 0 + } +} diff --git a/test/files/pos/t7694.scala b/test/files/pos/t7694.scala new file mode 100644 index 0000000000..9852d5ec79 --- /dev/null +++ b/test/files/pos/t7694.scala @@ -0,0 +1,40 @@ +trait A +trait B + +trait L[A2, B2 <: A2] { + def bar(a: Any, b: Any) = 0 +} + +object Lub { + // use named args transforms to include TypeTree(<lub.tpe>) in the AST before refchecks. + def foo(a: L[_, _], b: Any) = 0 + + foo(b = 0, a = if (true) (null: L[A, A]) else (null: L[B, B])) + + (if (true) (null: L[A, A]) else (null: L[B, B])).bar(b = 0, a = 0) +} + +/* +The LUB ends up as: + +TypeRef( + TypeSymbol( + abstract trait L#7038[A2#7039, B2#7040 <: A2#7039] extends AnyRef#2197 + + ) + args = List( + AbstractTypeRef( + AbstractType( + type _1#13680 >: A#7036 with B#7037 <: Object#1752 + ) + ) + AbstractTypeRef( + AbstractType( + type _2#13681 >: A#7036 with B#7037 <: Object#1752 + ) + ) + ) +) + +Note that type _2#13681 is *not* bound by _1#13680 +*/ diff --git a/test/files/pos/t7716.scala b/test/files/pos/t7716.scala new file mode 100644 index 0000000000..40117051ed --- /dev/null +++ b/test/files/pos/t7716.scala @@ -0,0 +1,16 @@ +object Test { + def test: Unit = { + val e: java.lang.Enum[_] = java.util.concurrent.TimeUnit.SECONDS + e match { case x => println(x) } + + + trait TA[X <: CharSequence] + val ta: TA[_] = new TA[String] {} + + ta match { + case _ => println("hi") + } + + def f(ta: TA[_]) = ta match { case _ => "hi" } + } +} diff --git a/test/files/pos/t942/Amount_1.java b/test/files/pos/t942/Amount_1.java new file mode 100644 index 0000000000..d9d37d127b --- /dev/null +++ b/test/files/pos/t942/Amount_1.java @@ -0,0 +1,5 @@ +import java.util.concurrent.Callable; + +public abstract class Amount_1<Q> extends Object + implements Callable<Amount_1<?>> { +} diff --git a/test/files/pos/t942/Test_2.scala b/test/files/pos/t942/Test_2.scala new file mode 100644 index 0000000000..3cc84dae3c --- /dev/null +++ b/test/files/pos/t942/Test_2.scala @@ -0,0 +1,3 @@ +abstract class Foo { + val x: Amount_1[Foo] +} |