From 87185f98441fc73835c100cf4170e9d9bb31c328 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Wed, 5 Apr 2006 13:48:28 +0000 Subject: fixed bug562 and bug563 --- src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index 41cfdf30bf..e88545992c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -176,8 +176,12 @@ abstract class RefChecks extends InfoTransform { overrideError("needs `override' modifier"); } else if ((other hasFlag ABSOVERRIDE) && other.isIncompleteIn(clazz) && !(member hasFlag ABSOVERRIDE)) { overrideError("needs `abstract override' modifiers"); - } else if (other.isStable && !member.isStable) { // (1.4) - overrideError("needs to be an immutable value"); + } else if (other.isStable) { + if (!member.isStable) // (1.4) + overrideError("needs to be an immutable value") + else if (!(other hasFlag DEFERRED) && other.owner.isTrait && (member hasFlag OVERRIDE)) + overrideError("cannot override a value or variable definition in a trait " + + "\n (this is an implementation restriction)") } else { if (other.isAliasType) { if (!member.typeParams.isEmpty) // (1.5) -- cgit v1.2.3