summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-01-08 19:18:36 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-01-08 19:18:45 +0100
commite5da30b843fe8bfe1638e3e08cdeaa4b6ae2f2d1 (patch)
tree41ff6686e366f95e22ebb9382605e1053a8a77cf /test/files/neg
parent1381cda86ddeca1b9829a9c53ff9372cfd816735 (diff)
downloadscala-e5da30b843fe8bfe1638e3e08cdeaa4b6ae2f2d1.tar.gz
scala-e5da30b843fe8bfe1638e3e08cdeaa4b6ae2f2d1.tar.bz2
scala-e5da30b843fe8bfe1638e3e08cdeaa4b6ae2f2d1.zip
Backport of SI-6846.
Squashed commit of the following: commit 55806cc0e6177820c12a35a18b4f2a12dc07bb39 Author: Paul Phillips <paulp@improving.org> Date: Wed Dec 19 07:32:19 2012 -0800 SI-6846, regression in type constructor inference. In 658ba1b4e6 some inference was gained and some was lost. In this commit we regain what was lost and gain even more. Dealiasing and widening should be fully handled now, as illustrated by the test case. (cherry picked from commit dbebcd509e4013ce02655a2687b27d0967b3650e) commit e6ef58447d0f4ef6de956fcc03ee283bb9028c02 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:11:29 2012 -0800 Cleaning up type alias usage. I determined that many if not most of the calls to .normalize have no intent beyond dealiasing the type. In light of this I went call site to call site knocking on doors and asking why exactly they were calling any of .normalize .widen.normalize .normalize.widen and if I didn't like their answers they found themselves introduced to 'dropAliasesAndSingleTypes', the recursive widener and dealiaser which I concluded is necessary after all. Discovered that the object called 'deAlias' actually depends upon calling 'normalize', not 'dealias'. Decided this was sufficient cause to rename it to 'normalizeAliases'. Created dealiasWiden and dealiasWidenChain. Dropped dropAliasesAndSingleTypes in favor of methods on Type alongside dealias and widen (Type#dealiasWiden). These should reduce the number of "hey, the type alias doesn't work" bugs. (cherry picked from commit 3bf51189f979eb0dd41744ca844fd12dfdaa0dee) Conflicts: src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala commit c1d8803cea1523f458730103386d8e14324a9446 Author: Paul Phillips <paulp@improving.org> Date: Sat Dec 22 08:13:48 2012 -0800 Shored up a hidden dealiasing dependency. Like the comment says: // 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. PS: Simply running the test suite is becoming more difficult all the time. Running "ant test" includes time consuming activities of niche interest such as all the osgi tests, but test.suite manages to miss the continuations tests. (cherry picked from commit 422f461578ae0547181afe6d2c0c52ea1071d37b) commit da4748502792b260161baa10939554564c488051 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 12:39:02 2012 -0800 Fix and simplify typedTypeConstructor. Investigating the useful output of devWarning (-Xdev people, it's good for you) led back to this comment: "normalize to get rid of type aliases" You may know that this is not all the normalizing does. Normalizing also turns TypeRefs with unapplied arguments (type constructors) into PolyTypes. That means that when typedParentType would call typedTypeConstructor it would find its parent had morphed into a PolyType. Not that it noticed; it would blithely continue and unwittingly discard the type arguments by way of appliedType (which smoothly logged the incident, thank you appliedType.) The simplification of typedTypeConstructor: There was a whole complicated special treatment of AnyRef here which appears to have become unnecessary. Removed special treatment and lit a candle for regularity. Updated lots of tests regarding newly not-so-special AnyRef. (cherry picked from commit 394cc426c1ff1da53146679b4e2995ece52a133e) commit 1f3c77bacb2fbb3ba9e4ad0a8a733e0f9263b234 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:06:10 2012 -0800 Removed dead implementation. Another "attractive nuisance" burning off time until I realized it was commented out. (cherry picked from commit ed40f5cbdf35d09b02898e9c0950b9bd34c1f858)
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/override-object-no.check4
-rw-r--r--test/files/neg/t2078.check2
-rw-r--r--test/files/neg/t2336.check2
-rw-r--r--test/files/neg/t3691.check2
-rw-r--r--test/files/neg/t4877.check6
-rw-r--r--test/files/neg/t5060.check4
-rw-r--r--test/files/neg/t5063.check2
-rw-r--r--test/files/neg/t6436.check4
-rw-r--r--test/files/neg/t6436b.check4
-rw-r--r--test/files/neg/t963.check2
10 files changed, 16 insertions, 16 deletions
diff --git a/test/files/neg/override-object-no.check b/test/files/neg/override-object-no.check
index 52bad2b937..9cfda80fc3 100644
--- a/test/files/neg/override-object-no.check
+++ b/test/files/neg/override-object-no.check
@@ -6,8 +6,8 @@ an overriding object must conform to the overridden object's class bound;
^
override-object-no.scala:21: error: overriding object Bar in trait Quux1 with object Bar in trait Quux2:
an overriding object must conform to the overridden object's class bound;
- found : Object{def g: String}
- required: Object{def g: Int}
+ found : AnyRef{def g: String}
+ required: AnyRef{def g: Int}
trait Quux2 extends Quux1 { override object Bar { def g = "abc" } } // err
^
override-object-no.scala:25: error: overriding object Bar in trait Quux3;
diff --git a/test/files/neg/t2078.check b/test/files/neg/t2078.check
index 3cdaa7d27a..00bb323a0b 100644
--- a/test/files/neg/t2078.check
+++ b/test/files/neg/t2078.check
@@ -1,4 +1,4 @@
-t2078.scala:2: error: contravariant type S occurs in covariant position in type => Object{val x: S} of value f
+t2078.scala:2: error: contravariant type S occurs in covariant position in type => AnyRef{val x: S} of value f
val f = new { val x = y }
^
one error found
diff --git a/test/files/neg/t2336.check b/test/files/neg/t2336.check
index 983717469c..28acd4d179 100644
--- a/test/files/neg/t2336.check
+++ b/test/files/neg/t2336.check
@@ -1,4 +1,4 @@
-t2336.scala:6: error: type Foo[Int] is not a stable prefix
+t2336.scala:6: error: Foo[Int] is not a legal prefix for a constructor
new Foo[Int]#Bar(0)
^
one error found
diff --git a/test/files/neg/t3691.check b/test/files/neg/t3691.check
index bdf6c268b2..6a7e13049a 100644
--- a/test/files/neg/t3691.check
+++ b/test/files/neg/t3691.check
@@ -9,7 +9,7 @@ t3691.scala:5: error: type mismatch;
val c = (new A[String]{}): { type A } // not ok
^
t3691.scala:7: error: type mismatch;
- found : Object{type A = String}
+ found : AnyRef{type A = String}
required: AnyRef{type A[X]}
val x = (new { type A = String }): { type A[X] } // not ok
^
diff --git a/test/files/neg/t4877.check b/test/files/neg/t4877.check
index a4b1e6a50d..5a2413ca8b 100644
--- a/test/files/neg/t4877.check
+++ b/test/files/neg/t4877.check
@@ -1,10 +1,10 @@
t4877.scala:4: error: type mismatch;
- found : Object{def bar: Int}
+ found : AnyRef{def bar: Int}
required: AnyRef{def bar: String}
def foo: AnyRef { def bar: String } = new AnyRef { def bar = 42 }
^
t4877.scala:6: error: type mismatch;
- found : Object{def bar(x: Int): String}
+ found : AnyRef{def bar(x: Int): String}
required: AnyRef{def bar(x: Int): Int}
def foo3: AnyRef { def bar(x: Int): Int } = new AnyRef { def bar(x: Int) = "abc" }
^
@@ -14,7 +14,7 @@ t4877.scala:7: error: type mismatch;
def foo4: C { def bar(x: Int): Int ; def quux(x: Int): Int } = new C { def bar(x: Int) = 5 }
^
t4877.scala:17: error: type mismatch;
- found : Object{type Mom = String; def bar(x: Int): Int; def bippy(): List[Int]}
+ found : AnyRef{type Mom = String; def bar(x: Int): Int; def bippy(): List[Int]}
required: B.this.Bippy
(which expands to) AnyRef{type Mom; def bar(x: Int): this.Mom; def bippy(): List[this.Mom]}
val x: Bippy = new AnyRef {
diff --git a/test/files/neg/t5060.check b/test/files/neg/t5060.check
index e71f30ccdb..09b2d9a4b1 100644
--- a/test/files/neg/t5060.check
+++ b/test/files/neg/t5060.check
@@ -1,7 +1,7 @@
-t5060.scala:2: error: covariant type T occurs in contravariant position in type => Object{def contains(x: T): Unit} of value foo0
+t5060.scala:2: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of value foo0
val foo0 = {
^
-t5060.scala:6: error: covariant type T occurs in contravariant position in type => Object{def contains(x: T): Unit} of method foo1
+t5060.scala:6: error: covariant type T occurs in contravariant position in type => AnyRef{def contains(x: T): Unit} of method foo1
def foo1 = {
^
two errors found
diff --git a/test/files/neg/t5063.check b/test/files/neg/t5063.check
index 84690d0a1d..c6e553c1b5 100644
--- a/test/files/neg/t5063.check
+++ b/test/files/neg/t5063.check
@@ -1,4 +1,4 @@
-t5063.scala:2: error: value + is not a member of Object
+t5063.scala:2: error: value + is not a member of AnyRef
super.+("")
^
one error found
diff --git a/test/files/neg/t6436.check b/test/files/neg/t6436.check
index ecb28f9100..5cee6fb558 100644
--- a/test/files/neg/t6436.check
+++ b/test/files/neg/t6436.check
@@ -2,8 +2,8 @@ t6436.scala:8: error: type mismatch;
found : StringContext
required: ?{def q: ?}
Note that implicit conversions are not applicable because they are ambiguous:
- both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
- and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
are possible conversion functions from StringContext to ?{def q: ?}
println(q"a")
^
diff --git a/test/files/neg/t6436b.check b/test/files/neg/t6436b.check
index b3c2d73739..21ab972b79 100644
--- a/test/files/neg/t6436b.check
+++ b/test/files/neg/t6436b.check
@@ -2,8 +2,8 @@ t6436b.scala:8: error: type mismatch;
found : StringContext
required: ?{def q: ?}
Note that implicit conversions are not applicable because they are ambiguous:
- both method foo1 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
- and method foo2 in object quasiquotes of type (ctx: StringContext)Object{def q: Nothing}
+ both method foo1 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
+ and method foo2 in object quasiquotes of type (ctx: StringContext)AnyRef{def q: Nothing}
are possible conversion functions from StringContext to ?{def q: ?}
println(StringContext("a").q())
^
diff --git a/test/files/neg/t963.check b/test/files/neg/t963.check
index 1f2d0687b3..4dc202c7bd 100644
--- a/test/files/neg/t963.check
+++ b/test/files/neg/t963.check
@@ -5,7 +5,7 @@ t963.scala:17: error: stable identifier required, but Test.this.y4.x found.
val w4 : y4.x.type = y4.x
^
t963.scala:10: error: type mismatch;
- found : Object{def x: Integer}
+ found : AnyRef{def x: Integer}
required: AnyRef{val x: Integer}
val y2 : { val x : java.lang.Integer } = new { def x = new java.lang.Integer(r.nextInt) }
^