From 52c99f57ef41c436719818b8e3860e3bfbf023e2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 13 Feb 2012 00:02:39 +0100 Subject: All steps of value class proposal implemented. Most restrictions are now enforced. Super calls and specialized still missing. --- test/files/neg/anyval-anyref-parent.check | 15 ++++++++++++--- test/files/neg/anyval-anyref-parent.scala | 7 ++++--- test/files/neg/t3222.check | 6 +++--- 3 files changed, 19 insertions(+), 9 deletions(-) (limited to 'test/files/neg') diff --git a/test/files/neg/anyval-anyref-parent.check b/test/files/neg/anyval-anyref-parent.check index be895867ff..e1903f5fcc 100644 --- a/test/files/neg/anyval-anyref-parent.check +++ b/test/files/neg/anyval-anyref-parent.check @@ -1,14 +1,23 @@ +anyval-anyref-parent.scala:2: error: Only classes (not traits) are allowed to extend AnyVal +trait Foo2 extends AnyVal // fail + ^ anyval-anyref-parent.scala:5: error: Any does not have a constructor class Bar1 extends Any // fail ^ -anyval-anyref-parent.scala:9: error: illegal inheritance; superclass Any +anyval-anyref-parent.scala:6: error: Value class needs to have exactly one public val parameter +class Bar2(x: Int) extends AnyVal // fail + ^ +anyval-anyref-parent.scala:10: 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 +anyval-anyref-parent.scala:11: 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 +anyval-anyref-parent.scala:11: error: Only classes (not traits) are allowed to extend AnyVal +trait Foo5 extends AnyVal with Immutable // fail + ^ +6 errors found diff --git a/test/files/neg/anyval-anyref-parent.scala b/test/files/neg/anyval-anyref-parent.scala index 08568487a9..f927992e59 100644 --- a/test/files/neg/anyval-anyref-parent.scala +++ b/test/files/neg/anyval-anyref-parent.scala @@ -1,10 +1,11 @@ trait Foo1 extends Any -trait Foo2 extends AnyVal +trait Foo2 extends AnyVal // fail trait Foo3 extends AnyRef class Bar1 extends Any // fail -@inline class Bar2 extends AnyVal -class Bar3 extends AnyRef +class Bar2(x: Int) extends AnyVal // fail +class Bar3(val x: Int) extends AnyVal // fail +class Bar4 extends AnyRef trait Foo4 extends Any with Immutable // fail trait Foo5 extends AnyVal with Immutable // fail diff --git a/test/files/neg/t3222.check b/test/files/neg/t3222.check index b1e1e50448..e724024f45 100644 --- a/test/files/neg/t3222.check +++ b/test/files/neg/t3222.check @@ -1,7 +1,7 @@ -t3222.scala:1: error: not found: type B -@throws(classOf[B]) - ^ t3222.scala:4: error: not found: type D def foo(@throws(classOf[D]) x: Int) {} ^ +t3222.scala:1: error: not found: type B +@throws(classOf[B]) + ^ two errors found -- cgit v1.2.3