summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-28 10:41:23 -0700
committerPaul Phillips <paulp@improving.org>2012-08-28 16:09:00 -0700
commit3cff2587d78eb6023ab1a584eba1bba8fd3660a0 (patch)
tree638deeaadc68eae24365858a0ae267a978422fc1
parent8ca87e36baaf2b834fe49610180a4e6c3d7b7fa0 (diff)
downloadscala-3cff2587d78eb6023ab1a584eba1bba8fd3660a0.tar.gz
scala-3cff2587d78eb6023ab1a584eba1bba8fd3660a0.tar.bz2
scala-3cff2587d78eb6023ab1a584eba1bba8fd3660a0.zip
Fix for SI-6283, no abstract value classes.
The needless abstraction penalty was in full flower in Namers. I managed to find somewhere else to issue this error, where I can still just write an error message without tracking down an enumeration in a separate file and inventing an intermediate name for the enum member.
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala2
-rw-r--r--test/files/neg/t6283.check4
-rw-r--r--test/files/neg/t6283.scala1
3 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index 9201981635..166bb2d18c 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -1618,6 +1618,8 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R
if ((clazz isSubClass AnyValClass) && !isPrimitiveValueClass(clazz)) {
if (clazz.isTrait)
unit.error(clazz.pos, "Only classes (not traits) are allowed to extend AnyVal")
+ else if ((clazz != AnyValClass) && clazz.hasFlag(ABSTRACT))
+ unit.error(clazz.pos, "`abstract' modifier cannot be used with value classes")
}
}
diff --git a/test/files/neg/t6283.check b/test/files/neg/t6283.check
new file mode 100644
index 0000000000..69e417ee93
--- /dev/null
+++ b/test/files/neg/t6283.check
@@ -0,0 +1,4 @@
+t6283.scala:1: error: `abstract' modifier cannot be used with value classes
+abstract class Funky(val i: Int) extends AnyVal
+ ^
+one error found
diff --git a/test/files/neg/t6283.scala b/test/files/neg/t6283.scala
new file mode 100644
index 0000000000..d41eb18a74
--- /dev/null
+++ b/test/files/neg/t6283.scala
@@ -0,0 +1 @@
+abstract class Funky(val i: Int) extends AnyVal