Permalink
Browse files

SI-6795 Adds negative check for "abstract override" on types in traits

"abstract override" shouldn't was being allowed on types in traits but the result
made no sense and the spec says that shouldn't be allowed.
  • Loading branch information...
James Iry
James Iry committed Dec 10, 2012
1 parent 7fe7d25 commit 71e42a799aa11fda75d9d3e7b92da9f61dd1da5b
@@ -1077,7 +1077,7 @@ trait ContextErrors {
"`override' modifier not allowed for constructors"
case AbstractOverride =>
- "`abstract override' modifier only allowed for members of traits"
+ "`abstract override' modifier only allowed for non-type members of traits"
case LazyAndEarlyInit =>
"`lazy' definitions may not be initialized early"
@@ -1443,8 +1443,8 @@ trait Namers extends MethodSynthesis {
if (sym.isConstructor && sym.isAnyOverride)
fail(OverrideConstr)
- if (sym.isAbstractOverride && !sym.owner.isTrait)
- fail(AbstractOverride)
+ if (sym.isAbstractOverride && (!sym.owner.isTrait || sym.isType))
+ fail(AbstractOverride)
if (sym.isLazy && sym.hasFlag(PRESUPER))
fail(LazyAndEarlyInit)
if (sym.info.typeSymbol == FunctionClass(0) && sym.isValueParameter && sym.owner.isCaseClass)
@@ -0,0 +1,4 @@
+t6795.scala:3: error: `abstract override' modifier only allowed for non-type members of traits
+trait T1 extends T { abstract override type U = Int }
+ ^
+one error found
@@ -0,0 +1,3 @@
+trait T { type U }
+// "abstract override" shouldn't be allowed on types
+trait T1 extends T { abstract override type U = Int }

0 comments on commit 71e42a7

Please sign in to comment.