diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-08-29 11:32:23 -0700 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2013-08-29 11:32:23 -0700 |
commit | a0da5a697a2a0841972907b66fa733ab3e0ca665 (patch) | |
tree | 0a5bfbb93fba1846272d1cb6018029880249eece /test/files | |
parent | 7817efe2468480317965fc5baece52be392f0f7a (diff) | |
parent | ba86ac61f489573d10590c5fc601e73673f204f1 (diff) | |
download | scala-a0da5a697a2a0841972907b66fa733ab3e0ca665.tar.gz scala-a0da5a697a2a0841972907b66fa733ab3e0ca665.tar.bz2 scala-a0da5a697a2a0841972907b66fa733ab3e0ca665.zip |
Merge remote-tracking branch 'scala/2.10.x'
After the merge, the test/run/t7733 started to fail on Jenkins.
I tried to reproduce it locally but I couldn't so I think it's
system dependent failure. Per @retronym's suggestion I moved it to pending
to not block the whole merge.
Conflicts:
bincompat-backward.whitelist.conf
bincompat-forward.whitelist.conf
src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala
src/compiler/scala/tools/nsc/typechecker/Macros.scala
src/compiler/scala/tools/nsc/typechecker/Namers.scala
src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
src/compiler/scala/tools/nsc/util/MsilClassPath.scala
src/compiler/scala/tools/reflect/ToolBoxFactory.scala
src/reflect/scala/reflect/internal/ClassfileConstants.scala
src/reflect/scala/reflect/internal/Importers.scala
src/reflect/scala/reflect/internal/Trees.scala
src/reflect/scala/reflect/runtime/JavaMirrors.scala
test/files/run/macro-duplicate/Impls_Macros_1.scala
test/files/run/t6392b.check
test/files/run/t7331c.check
Diffstat (limited to 'test/files')
33 files changed, 337 insertions, 3 deletions
diff --git a/test/files/neg/macro-abort.check b/test/files/neg/macro-abort.check new file mode 100644 index 0000000000..1e58add533 --- /dev/null +++ b/test/files/neg/macro-abort.check @@ -0,0 +1,4 @@ +Test_2.scala:2: error: aborted + Macros.abort + ^ +one error found diff --git a/test/files/neg/macro-abort/Macros_1.scala b/test/files/neg/macro-abort/Macros_1.scala new file mode 100644 index 0000000000..676c112098 --- /dev/null +++ b/test/files/neg/macro-abort/Macros_1.scala @@ -0,0 +1,9 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = { + c.abort(c.enclosingPosition, "aborted") + } + def abort = macro impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-abort/Test_2.scala b/test/files/neg/macro-abort/Test_2.scala new file mode 100644 index 0000000000..1d0a7a25dc --- /dev/null +++ b/test/files/neg/macro-abort/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.abort +}
\ No newline at end of file diff --git a/test/files/neg/macro-exception.check b/test/files/neg/macro-exception.check new file mode 100644 index 0000000000..cee8b32ebd --- /dev/null +++ b/test/files/neg/macro-exception.check @@ -0,0 +1,7 @@ +Test_2.scala:2: error: exception during macro expansion: +java.lang.Exception + at Macros$.impl(Macros_1.scala:6) + + Macros.exception + ^ +one error found diff --git a/test/files/neg/macro-exception/Macros_1.scala b/test/files/neg/macro-exception/Macros_1.scala new file mode 100644 index 0000000000..60e4020aec --- /dev/null +++ b/test/files/neg/macro-exception/Macros_1.scala @@ -0,0 +1,9 @@ +import scala.language.experimental.macros +import scala.reflect.macros.Context + +object Macros { + def impl(c: Context) = { + throw new Exception() + } + def exception = macro impl +}
\ No newline at end of file diff --git a/test/files/neg/macro-exception/Test_2.scala b/test/files/neg/macro-exception/Test_2.scala new file mode 100644 index 0000000000..d82b21f2b2 --- /dev/null +++ b/test/files/neg/macro-exception/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + Macros.exception +}
\ No newline at end of file diff --git a/test/files/neg/t7020.check b/test/files/neg/t7020.check new file mode 100644 index 0000000000..f9600ca7fc --- /dev/null +++ b/test/files/neg/t7020.check @@ -0,0 +1,19 @@ +t7020.scala:3: warning: match may not be exhaustive. +It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) + List(5) match { + ^ +t7020.scala:10: warning: match may not be exhaustive. +It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) + List(5) match { + ^ +t7020.scala:17: warning: match may not be exhaustive. +It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) + List(5) match { + ^ +t7020.scala:24: warning: match may not be exhaustive. +It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) + List(5) match { + ^ +error: No warnings can be incurred under -Xfatal-warnings. +four warnings found +one error found diff --git a/test/files/neg/t7020.flags b/test/files/neg/t7020.flags new file mode 100644 index 0000000000..e8fb65d50c --- /dev/null +++ b/test/files/neg/t7020.flags @@ -0,0 +1 @@ +-Xfatal-warnings
\ No newline at end of file diff --git a/test/files/neg/t7020.scala b/test/files/neg/t7020.scala new file mode 100644 index 0000000000..cc5421bab1 --- /dev/null +++ b/test/files/neg/t7020.scala @@ -0,0 +1,30 @@ +object Test { + // warning was non-deterministic + List(5) match { + case 1 :: Nil | 2 :: Nil => + case (x@(4 | 5 | 6)) :: Nil => + case 7 :: Nil => + case Nil => + } + + List(5) match { + case 1 :: Nil | 2 :: Nil => + case (x@(4 | 5 | 6)) :: Nil => + case 7 :: Nil => + case Nil => + } + + List(5) match { + case 1 :: Nil | 2 :: Nil => + case (x@(4 | 5 | 6)) :: Nil => + case 7 :: Nil => + case Nil => + } + + List(5) match { + case 1 :: Nil | 2 :: Nil => + case (x@(4 | 5 | 6)) :: Nil => + case 7 :: Nil => + case Nil => + } +} diff --git a/test/files/neg/t7694b.check b/test/files/neg/t7694b.check new file mode 100644 index 0000000000..ea3d7736f8 --- /dev/null +++ b/test/files/neg/t7694b.check @@ -0,0 +1,7 @@ +t7694b.scala:8: error: type arguments [_3,_4] do not conform to trait L's type parameter bounds [A2,B2 <: A2] + def d = if (true) (null: L[A, A]) else (null: L[B, B]) + ^ +t7694b.scala:9: error: type arguments [_1,_2] do not conform to trait L's type parameter bounds [A2,B2 <: A2] + val v = if (true) (null: L[A, A]) else (null: L[B, B]) + ^ +two errors found diff --git a/test/files/neg/t7752.check b/test/files/neg/t7752.check new file mode 100644 index 0000000000..0a015d3f37 --- /dev/null +++ b/test/files/neg/t7752.check @@ -0,0 +1,27 @@ +t7752.scala:25: error: overloaded method value foo with alternatives: + [A](heading: String, rows: A*)(A,) <and> + [A, B](heading: (String, String), rows: (A, B)*)(A, B) <and> + [A, B, C](heading: (String, String, String), rows: (A, B, C)*)(A, B, C) <and> + [A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*)(A, B, C, D) <and> + [A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*)(A, B, C, D, E) <and> + [A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*)(A, B, C, D, E, F) <and> + [A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*)(A, B, C, D, E, F, G) <and> + [A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*)(A, B, C, D, E, F, G, H) <and> + [A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*)(A, B, C, D, E, F, G, H, I) <and> + [A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*)(A, B, C, D, E, F, G, H, I, J) <and> + [A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*)(A, B, C, D, E, F, G, H, I, J, K) <and> + [A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*)(A, B, C, D, E, F, G, H, I, J, K, L) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*)(A, B, C, D, E, F, G, H, I, J, K, L, M) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U) <and> + [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*)(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V) + cannot be applied to (Int) + foo((1)) + ^ +one error found diff --git a/test/files/neg/t7752.scala b/test/files/neg/t7752.scala new file mode 100644 index 0000000000..40ba2103b1 --- /dev/null +++ b/test/files/neg/t7752.scala @@ -0,0 +1,26 @@ +object Test { + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V)*): Tuple22[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U)*): Tuple21[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T)*): Tuple20[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S)*): Tuple19[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R)*): Tuple18[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q)*): Tuple17[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P)*): Tuple16[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N, O](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O)*): Tuple15[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M, N](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M, N)*): Tuple14[A,B,C,D,E,F,G,H,I,J,K,L,M,N] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L, M](heading: (String, String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L, M)*): Tuple13[A,B,C,D,E,F,G,H,I,J,K,L,M] = null + def foo[A, B, C, D, E, F, G, H, I, J, K, L](heading: (String, String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K, L)*): Tuple12[A,B,C,D,E,F,G,H,I,J,K,L] = null + def foo[A, B, C, D, E, F, G, H, I, J, K](heading: (String, String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J, K)*): Tuple11[A,B,C,D,E,F,G,H,I,J,K] = null + def foo[A, B, C, D, E, F, G, H, I, J](heading: (String, String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I, J)*): Tuple10[A,B,C,D,E,F,G,H,I,J] = null + def foo[A, B, C, D, E, F, G, H, I](heading: (String, String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H, I)*): Tuple9[A,B,C,D,E,F,G,H,I] = null + def foo[A, B, C, D, E, F, G, H](heading: (String, String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G, H)*): Tuple8[A,B,C,D,E,F,G,H] = null + def foo[A, B, C, D, E, F, G](heading: (String, String, String, String, String, String, String), rows: (A, B, C, D, E, F, G)*): Tuple7[A,B,C,D,E,F,G] = null + def foo[A, B, C, D, E, F](heading: (String, String, String, String, String, String), rows: (A, B, C, D, E, F)*): Tuple6[A,B,C,D,E,F] = null + def foo[A, B, C, D, E](heading: (String, String, String, String, String), rows: (A, B, C, D, E)*): Tuple5[A,B,C,D,E] = null + def foo[A, B, C, D](heading: (String, String, String, String), rows: (A, B, C, D)*): Tuple4[A,B,C,D] = null + def foo[A, B, C](heading: (String, String, String), rows: (A, B, C)*): Tuple3[A,B,C] = null + def foo[A, B](heading: (String, String), rows: (A, B)*): Tuple2[A,B] = null + def foo[A](heading: String, rows: A*): Tuple1[A] = null + + foo((1)) +}
\ No newline at end of file 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] +} diff --git a/test/files/run/macro-auto-duplicate.check b/test/files/run/macro-auto-duplicate.check new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/files/run/macro-auto-duplicate.check @@ -0,0 +1 @@ +42 diff --git a/test/files/run/macro-auto-duplicate/Macros_1.scala b/test/files/run/macro-auto-duplicate/Macros_1.scala new file mode 100644 index 0000000000..e3df05ba50 --- /dev/null +++ b/test/files/run/macro-auto-duplicate/Macros_1.scala @@ -0,0 +1,17 @@ +import scala.reflect.macros.Context +import language.experimental.macros + +object Macros { + def impl(c: Context) = { + import c.universe._ + val x = Ident(newTermName("x")) + def defAndUseX(rhs: Tree) = { + Block(List(ValDef(NoMods, newTermName("x"), TypeTree(), rhs)), x) + } + val xi4 = defAndUseX(Literal(Constant(4))) + val xs2 = defAndUseX(Literal(Constant("2"))) + c.Expr[String](Apply(Select(xi4, newTermName("$plus")), List(xs2))) + } + + def foo = macro impl +}
\ No newline at end of file diff --git a/test/files/run/macro-auto-duplicate/Test_2.scala b/test/files/run/macro-auto-duplicate/Test_2.scala new file mode 100644 index 0000000000..f697da6020 --- /dev/null +++ b/test/files/run/macro-auto-duplicate/Test_2.scala @@ -0,0 +1,3 @@ +object Test extends App { + println(Macros.foo) +}
\ No newline at end of file diff --git a/test/files/run/macro-duplicate/Impls_Macros_1.scala b/test/files/run/macro-duplicate/Impls_Macros_1.scala index af80147a90..85a581585f 100644 --- a/test/files/run/macro-duplicate/Impls_Macros_1.scala +++ b/test/files/run/macro-duplicate/Impls_Macros_1.scala @@ -26,4 +26,4 @@ object Macros { } def foo = macro impl -}
\ No newline at end of file +} diff --git a/test/files/run/reflection-magicsymbols-invoke.check b/test/files/run/reflection-magicsymbols-invoke.check index f5258efeb7..352aefaf25 100644 --- a/test/files/run/reflection-magicsymbols-invoke.check +++ b/test/files/run/reflection-magicsymbols-invoke.check @@ -82,7 +82,7 @@ Array it's important to print the list of Array's members if some of them change (possibly, adding and/or removing magic symbols), we must update this test constructor Array: (_length: Int)Array[T] -constructor Object: ()java.lang.Object +constructor Cloneable: ()java.lang.Cloneable method !=: (x$1: Any)Boolean method !=: (x$1: AnyRef)Boolean method ##: ()Int diff --git a/test/files/run/t6392b.check b/test/files/run/t6392b.check index 2afc48495f..1ccfced1c6 100644 --- a/test/files/run/t6392b.check +++ b/test/files/run/t6392b.check @@ -1 +1 @@ -ModuleDef(Modifiers(), TermName("C"), Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(()))))))) +ModuleDef(Modifiers(), TermName("C")#MOD, Template(List(Select(Ident(scala#PK), TypeName("AnyRef")#TPE)), emptyValDef, List(DefDef(Modifiers(), nme.CONSTRUCTOR#PCTOR, List(), List(List()), TypeTree(), Block(List(Apply(Select(Super(This(TypeName("C")), tpnme.EMPTY), nme.CONSTRUCTOR#PCTOR), List())), Literal(Constant(()))))))) diff --git a/test/files/run/t6989.check b/test/files/run/t6989.check index 8943792115..43d4bbaf02 100644 --- a/test/files/run/t6989.check +++ b/test/files/run/t6989.check @@ -101,6 +101,12 @@ isProtected = false isPublic = false privateWithin = <none> ============ +sym = constructor $PrivateJavaClass, signature = ()JavaClass_1.this.$PrivateJavaClass, owner = class $PrivateJavaClass +isPrivate = false +isProtected = false +isPublic = true +privateWithin = <none> +============ sym = value this$0, signature = foo.JavaClass_1, owner = class $PrivateJavaClass isPrivate = false isProtected = false @@ -119,6 +125,12 @@ isProtected = true isPublic = false privateWithin = package foo ============ +sym = constructor $ProtectedJavaClass, signature = ()JavaClass_1.this.$ProtectedJavaClass, owner = class $ProtectedJavaClass +isPrivate = false +isProtected = false +isPublic = true +privateWithin = <none> +============ sym = value this$0, signature = foo.JavaClass_1, owner = class $ProtectedJavaClass isPrivate = false isProtected = false @@ -173,6 +185,12 @@ isProtected = false isPublic = false privateWithin = <none> ============ +sym = constructor PrivateStaticJavaClass, signature = ()foo.JavaClass_1.PrivateStaticJavaClass, owner = class PrivateStaticJavaClass +isPrivate = false +isProtected = false +isPublic = true +privateWithin = <none> +============ sym = object PrivateStaticJavaClass, signature = foo.JavaClass_1.PrivateStaticJavaClass.type, owner = object JavaClass_1 isPrivate = true isProtected = false @@ -185,6 +203,12 @@ isProtected = false isPublic = false privateWithin = <none> ============ +sym = constructor ProtectedStaticJavaClass, signature = ()foo.JavaClass_1.ProtectedStaticJavaClass, owner = class ProtectedStaticJavaClass +isPrivate = false +isProtected = false +isPublic = true +privateWithin = <none> +============ sym = object ProtectedStaticJavaClass, signature = foo.JavaClass_1.ProtectedStaticJavaClass.type, owner = object JavaClass_1 isPrivate = true isProtected = false diff --git a/test/files/run/t7510.check b/test/files/run/t7510.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/t7510.check diff --git a/test/files/run/t7510/Ann_1.java b/test/files/run/t7510/Ann_1.java new file mode 100644 index 0000000000..c8c5b2035f --- /dev/null +++ b/test/files/run/t7510/Ann_1.java @@ -0,0 +1,4 @@ +package foo; + +public @interface Ann_1 { +}
\ No newline at end of file diff --git a/test/files/run/t7510/Test_2.scala b/test/files/run/t7510/Test_2.scala new file mode 100644 index 0000000000..7d7a95e0f2 --- /dev/null +++ b/test/files/run/t7510/Test_2.scala @@ -0,0 +1,9 @@ +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{currentMirror => cm} +import scala.tools.reflect.ToolBox + +object Test extends App { + val tb = cm.mkToolBox() + tb.compile(tb.parse("@foo.Ann_1 class C")) +} + diff --git a/test/files/run/toolbox_current_run_compiles.check b/test/files/run/toolbox_current_run_compiles.check new file mode 100644 index 0000000000..da29283aaa --- /dev/null +++ b/test/files/run/toolbox_current_run_compiles.check @@ -0,0 +1,2 @@ +true +false diff --git a/test/files/run/toolbox_current_run_compiles.scala b/test/files/run/toolbox_current_run_compiles.scala new file mode 100644 index 0000000000..b48c998e64 --- /dev/null +++ b/test/files/run/toolbox_current_run_compiles.scala @@ -0,0 +1,28 @@ +package pkg { + import scala.reflect.macros.Context + import scala.language.experimental.macros + + object Macros { + def impl[T: c.WeakTypeTag](c: Context) = { + import c.universe._ + val sym = c.weakTypeOf[T].typeSymbol + val g = c.universe.asInstanceOf[scala.tools.nsc.Global] + c.Expr[Boolean](Literal(Constant(g.currentRun.compiles(sym.asInstanceOf[g.Symbol])))) + } + def compiles[T] = macro impl[T] + } +} + +import scala.reflect.runtime.universe._ +import scala.reflect.runtime.{universe => ru} +import scala.tools.reflect.ToolBox + +object Test extends App { + val cm = ru.runtimeMirror(getClass.getClassLoader) + val toolbox = cm.mkToolBox() + toolbox.eval(toolbox.parse("""{ + class C + println(pkg.Macros.compiles[C]) + println(pkg.Macros.compiles[Object]) + }""")) +}
\ No newline at end of file |