diff options
author | Paul Phillips <paulp@improving.org> | 2012-02-06 13:11:30 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-02-06 15:12:45 -0800 |
commit | 7f9c2636cf560b066783e0745a08393ce17531cd (patch) | |
tree | 225407c8dc22bab25301f9916c6c70eaba00d0ae /test/files/neg | |
parent | 7539c4ee51c25a684399cd5400bf0285e6508fe2 (diff) | |
download | scala-7f9c2636cf560b066783e0745a08393ce17531cd.tar.gz scala-7f9c2636cf560b066783e0745a08393ce17531cd.tar.bz2 scala-7f9c2636cf560b066783e0745a08393ce17531cd.zip |
Removing unnecessary AnyVal code.
...since it works from source. The parser must be forcibly restrained
from adding a bogus constructor, but other than that it's pretty much
smooth sailing. To give an idea how smooth, if I change scala.Short like so:
trait Bippy extends Any
final class Short extends AnyVal with Bippy
Then it just works, at least until the fiction is revealed.
scala> def f(x: Bippy) = x
f: (x: Bippy)Bippy
scala> f(5)
<console>:9: error: type mismatch;
found : Int(5)
required: Bippy
f(5)
^
scala> f(5: Short)
java.lang.ClassCastException: java.lang.Short cannot be cast to scala.Bippy
at .<init>(<console>:9)
at .<clinit>(<console>)
at .<init>(<console>:11)
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/anyval-anyref-parent.check | 12 | ||||
-rw-r--r-- | test/files/neg/anyval-anyref-parent.scala | 4 | ||||
-rw-r--r-- | test/files/neg/anyval-children-2.check | 4 | ||||
-rw-r--r-- | test/files/neg/anyval-children-2.scala | 1 | ||||
-rw-r--r-- | test/files/neg/anyval-children.check | 23 | ||||
-rw-r--r-- | test/files/neg/anyval-children.scala | 14 |
6 files changed, 15 insertions, 43 deletions
diff --git a/test/files/neg/anyval-anyref-parent.check b/test/files/neg/anyval-anyref-parent.check index b40a0f2710..be895867ff 100644 --- a/test/files/neg/anyval-anyref-parent.check +++ b/test/files/neg/anyval-anyref-parent.check @@ -1,4 +1,14 @@ anyval-anyref-parent.scala:5: error: Any does not have a constructor class Bar1 extends Any // fail ^ -one error found +anyval-anyref-parent.scala:9: error: illegal inheritance; superclass Any + is not a subclass of the superclass Object + of the mixin trait Immutable +trait Foo4 extends Any with Immutable // fail + ^ +anyval-anyref-parent.scala:10: error: illegal inheritance; superclass AnyVal + is not a subclass of the superclass Object + of the mixin trait Immutable +trait Foo5 extends AnyVal with Immutable // fail + ^ +three errors found diff --git a/test/files/neg/anyval-anyref-parent.scala b/test/files/neg/anyval-anyref-parent.scala index b7bb122ea8..08568487a9 100644 --- a/test/files/neg/anyval-anyref-parent.scala +++ b/test/files/neg/anyval-anyref-parent.scala @@ -5,3 +5,7 @@ trait Foo3 extends AnyRef class Bar1 extends Any // fail @inline class Bar2 extends AnyVal class Bar3 extends AnyRef + +trait Foo4 extends Any with Immutable // fail +trait Foo5 extends AnyVal with Immutable // fail +trait Foo6 extends AnyRef with Immutable diff --git a/test/files/neg/anyval-children-2.check b/test/files/neg/anyval-children-2.check deleted file mode 100644 index cb327faeeb..0000000000 --- a/test/files/neg/anyval-children-2.check +++ /dev/null @@ -1,4 +0,0 @@ -anyval-children-2.scala:1: error: Only @inline classes (not traits) are allowed to extend AnyVal -@inline trait NotOkDingus1 extends AnyVal // fail - ^ -one error found diff --git a/test/files/neg/anyval-children-2.scala b/test/files/neg/anyval-children-2.scala deleted file mode 100644 index 4034eb22dd..0000000000 --- a/test/files/neg/anyval-children-2.scala +++ /dev/null @@ -1 +0,0 @@ -@inline trait NotOkDingus1 extends AnyVal // fail diff --git a/test/files/neg/anyval-children.check b/test/files/neg/anyval-children.check deleted file mode 100644 index 769f990210..0000000000 --- a/test/files/neg/anyval-children.check +++ /dev/null @@ -1,23 +0,0 @@ -anyval-children.scala:3: error: class AnyVal needs to be a trait to be mixed in -@inline class NotOkDingus2 extends Immutable with AnyVal // fail - ^ -anyval-children.scala:7: error: Bippy does not have a constructor -class NotOkBippy1 extends Bippy // fail - ^ -anyval-children.scala:9: error: illegal inheritance; superclass Bippy - is not a subclass of the superclass Object - of the mixin trait Immutable -class NotOkBippy2 extends Bippy with Immutable //fail - ^ -anyval-children.scala:9: error: Bippy does not have a constructor -class NotOkBippy2 extends Bippy with Immutable //fail - ^ -anyval-children.scala:11: error: illegal inheritance; superclass Bippy - is not a subclass of the superclass Object - of the mixin trait Immutable -@inline class NotOkBippy3 extends Bippy with Immutable //fail - ^ -anyval-children.scala:11: error: Bippy does not have a constructor -@inline class NotOkBippy3 extends Bippy with Immutable //fail - ^ -6 errors found diff --git a/test/files/neg/anyval-children.scala b/test/files/neg/anyval-children.scala deleted file mode 100644 index 5a6109f786..0000000000 --- a/test/files/neg/anyval-children.scala +++ /dev/null @@ -1,14 +0,0 @@ -class Bippy extends AnyVal // fail - -@inline class NotOkDingus2 extends Immutable with AnyVal // fail - -@inline object NotOkDingus3 extends AnyVal // fail - -class NotOkBippy1 extends Bippy // fail - -class NotOkBippy2 extends Bippy with Immutable //fail - -@inline class NotOkBippy3 extends Bippy with Immutable //fail - - -@inline class OkBippy extends AnyVal // ok |