summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala8
-rw-r--r--test/files/continuations-neg/function2.check2
-rw-r--r--test/files/continuations-neg/t5314-type-error.check4
-rw-r--r--test/files/jvm/annotations.check15
-rw-r--r--test/files/jvm/annotations.scala6
5 files changed, 31 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ad2ec7ff6c..abc5baff72 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -4208,7 +4208,13 @@ trait Typers extends Modes with Adaptations with Tags {
def typedNew(tree: New) = {
val tpt = tree.tpt
val tpt1 = {
- val tpt0 = typedTypeConstructor(tpt)
+ // This way typedNew always returns a dealiased type. This used to happen by accident
+ // for instantiations without type arguments due to ad hoc code in typedTypeConstructor,
+ // and annotations depended on it (to the extent that they worked, which they did
+ // not when given a parameterized type alias which dealiased to an annotation.)
+ // typedTypeConstructor dealiases nothing now, but it makes sense for a "new" to always be
+ // given a dealiased type.
+ val tpt0 = typedTypeConstructor(tpt) modifyType (_.dealias)
if (checkStablePrefixClassType(tpt0))
if (tpt0.hasSymbolField && !tpt0.symbol.typeParams.isEmpty) {
context.undetparams = cloneSymbols(tpt0.symbol.typeParams)
diff --git a/test/files/continuations-neg/function2.check b/test/files/continuations-neg/function2.check
index 82b81c1444..4b1a6227bc 100644
--- a/test/files/continuations-neg/function2.check
+++ b/test/files/continuations-neg/function2.check
@@ -1,6 +1,6 @@
function2.scala:11: error: type mismatch;
found : () => Int
- required: () => Int @util.continuations.cps[Int]
+ required: () => Int @scala.util.continuations.cpsParam[Int,Int]
val g: () => Int @cps[Int] = f
^
one error found
diff --git a/test/files/continuations-neg/t5314-type-error.check b/test/files/continuations-neg/t5314-type-error.check
index 1f4e46a7f2..e66c9d833f 100644
--- a/test/files/continuations-neg/t5314-type-error.check
+++ b/test/files/continuations-neg/t5314-type-error.check
@@ -1,6 +1,6 @@
t5314-type-error.scala:7: error: type mismatch;
- found : Int @util.continuations.cps[Int]
- required: Int @util.continuations.cps[String]
+ found : Int @scala.util.continuations.cpsParam[Int,Int]
+ required: Int @scala.util.continuations.cpsParam[String,String]
def bar(x:Int): Int @cps[String] = return foo(x)
^
one error found
diff --git a/test/files/jvm/annotations.check b/test/files/jvm/annotations.check
index 8a4d58d56c..a8dc5ecdd1 100644
--- a/test/files/jvm/annotations.check
+++ b/test/files/jvm/annotations.check
@@ -28,6 +28,21 @@ public Test4$Foo8(int)
@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
private int Test4$Foo9.z
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+private int Test4$Foo9.z2
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+private int Test4$Foo9.z3
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+public int Test4$Foo9.getZ()
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+public int Test4$Foo9.getZ2()
+
+@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://eppli.com)
+public int Test4$Foo9.getZ3()
+
@test.SourceAnnotation(mails={bill.gates@bloodsuckers.com}, value=http://apple.com)
public int Test4$Foo9.x()
diff --git a/test/files/jvm/annotations.scala b/test/files/jvm/annotations.scala
index 66ebde592b..77a45fae89 100644
--- a/test/files/jvm/annotations.scala
+++ b/test/files/jvm/annotations.scala
@@ -101,6 +101,12 @@ object Test4 {
type myAnn = SourceAnnotation @beanGetter @field
@BeanProperty @myAnn("http://eppli.com") var z = 0
+
+ type myAnn2[T] = SourceAnnotation @beanGetter @field
+ @BeanProperty @myAnn2[String]("http://eppli.com") var z2 = 0
+
+ type myAnn3[CC[_]] = SourceAnnotation @beanGetter @field
+ @BeanProperty @myAnn3[List]("http://eppli.com") var z3 = 0
}
class Foo10(@SourceAnnotation("on param 1") val name: String)
class Foo11(@(SourceAnnotation @scala.annotation.meta.field)("on param 2") val name: String)