diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/RefChecks.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index e2fb367d20..fda6a6f12e 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -249,9 +249,6 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R } } - def isAbstractTypeWithoutFBound(sym: Symbol) = // (part of DEVIRTUALIZE) - sym.isAbstractType && !sym.isFBounded - def infoString(sym: Symbol) = infoString0(sym, sym.owner != clazz) def infoStringWithLocation(sym: Symbol) = infoString0(sym, true) @@ -371,14 +368,13 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R overrideError("cannot be used here - classes can only override abstract types"); } else if (other.isFinal) { // (1.2) overrideError("cannot override final member"); - } else if (!other.isDeferred && !(member hasFlag (OVERRIDE | ABSOVERRIDE | SYNTHETIC))) { // (1.3), SYNTHETIC because of DEVIRTUALIZE + } else if (!other.isDeferred && !member.isAnyOverride) { overrideError("needs `override' modifier"); - } else if ((other hasFlag ABSOVERRIDE) && other.isIncompleteIn(clazz) && !(member hasFlag ABSOVERRIDE)) { + } else if (other.isAbstractOverride && other.isIncompleteIn(clazz) && !member.isAbstractOverride) { overrideError("needs `abstract override' modifiers") - } else if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) && - (other hasFlag ACCESSOR) && other.accessed.isVariable && !other.accessed.isLazy) { + } else if (member.isAnyOverride && (other hasFlag ACCESSOR) && other.accessed.isVariable && !other.accessed.isLazy) { overrideError("cannot override a mutable variable") - } else if ((member hasFlag (OVERRIDE | ABSOVERRIDE)) && + } else if (member.isAnyOverride && !(member.owner.thisType.baseClasses exists (_ isSubClass other.owner)) && !member.isDeferred && !other.isDeferred && intersectionIsEmpty(member.extendedOverriddenSymbols, other.extendedOverriddenSymbols)) { @@ -386,11 +382,11 @@ abstract class RefChecks extends InfoTransform with reflect.internal.transform.R "(this rule is designed to prevent ``accidental overrides'')") } else if (other.isStable && !member.isStable) { // (1.4) overrideError("needs to be a stable, immutable value") - } else if (member.isValue && (member hasFlag LAZY) && - other.isValue && !other.isSourceMethod && !other.isDeferred && !(other hasFlag LAZY)) { + } else if (member.isValue && member.isLazy && + other.isValue && !other.isSourceMethod && !other.isDeferred && !other.isLazy) { overrideError("cannot override a concrete non-lazy value") - } else if (other.isValue && (other hasFlag LAZY) && !other.isSourceMethod && !other.isDeferred && - member.isValue && !(member hasFlag LAZY)) { + } else if (other.isValue && other.isLazy && !other.isSourceMethod && !other.isDeferred && + member.isValue && !member.isLazy) { overrideError("must be declared lazy to override a concrete lazy value") } else { checkOverrideTypes() |