diff options
-rw-r--r-- | build.xml | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala | 1 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 28 | ||||
-rwxr-xr-x | src/library/scala/reflect/generic/AnnotationInfos.scala | 8 | ||||
-rw-r--r-- | test/files/neg/bug2213.check | 15 | ||||
-rw-r--r-- | test/files/neg/bug2213.scala | 11 | ||||
-rw-r--r-- | test/files/neg/bug856.check | 4 |
7 files changed, 53 insertions, 20 deletions
@@ -1502,9 +1502,9 @@ BOOTRAPING TEST AND TEST SUITE <target name="test.suite" depends="pack.done"> <partest classpathref="pack.classpath"> <env key="PATH" path="${build-pack.dir}/bin:${env.PATH}" /> - <sysproperty key="partest.timeout" value="14400" /> - <sysproperty key="partest.test-warning" value="150" /> - <sysproperty key="partest.test-timeout" value="1200" /> + <sysproperty key="partest.timeout" value="36000" /> + <sysproperty key="partest.test-warning" value="300" /> + <sysproperty key="partest.test-timeout" value="1800" /> <sysproperty key="partest.srcdir" value="files" /> <sysproperty key="partest.scalacopts" value="${scalac.args.all}" /> <sysproperty key="partest.javacopts" value="${javac.args}" /> diff --git a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala index edc87108b4..f2e62856d5 100644 --- a/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala +++ b/src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala @@ -56,7 +56,6 @@ trait AnnotationInfos extends reflect.generic.AnnotationInfos { self: SymbolTabl else definitions.ScalaSignatureAnnotation.tpe } - object ScalaSigBytes extends ScalaSigBytesExtractor /** Represents a nested classfile annotation */ case class NestedAnnotArg(annInfo: AnnotationInfo) diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index ea4109bd3a..72f6f1ae39 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -393,12 +393,22 @@ abstract class RefChecks extends InfoTransform { // 2. Check that only abstract classes have deferred members if (clazz.isClass && !clazz.isTrait) { + def isClazzAbstract = clazz hasFlag ABSTRACT + val abstractErrors = new ListBuffer[String] + def abstractErrorMessage = + // a little formatting polish + if (abstractErrors.size <= 2) abstractErrors mkString " " + else abstractErrors.tail.mkString(abstractErrors.head + ":\n", "\n", "") + def abstractClassError(mustBeMixin: Boolean, msg: String) { - unit.error(clazz.pos, - (if (clazz.isAnonymousClass || clazz.isModuleClass) "object creation impossible" - else if (mustBeMixin) clazz.toString() + " needs to be a mixin" - else clazz.toString() + " needs to be abstract") + ", since " + msg); - clazz.setFlag(ABSTRACT) + def prelude = ( + if (clazz.isAnonymousClass || clazz.isModuleClass) "object creation impossible" + else if (mustBeMixin) clazz + " needs to be a mixin" + else clazz + " needs to be abstract" + ) + ", since" + + if (abstractErrors.isEmpty) abstractErrors ++= List(prelude, msg) + else abstractErrors += msg } def javaErasedOverridingSym(sym: Symbol): Symbol = @@ -415,7 +425,7 @@ abstract class RefChecks extends InfoTransform { ((member hasFlag JAVA) && javaErasedOverridingSym(member) != NoSymbol) for (member <- clazz.tpe.nonPrivateMembersAdmitting(VBRIDGE)) - if (member.isDeferred && !(clazz hasFlag ABSTRACT) && !ignoreDeferred(member)) { + if (member.isDeferred && !isClazzAbstract && !ignoreDeferred(member)) { abstractClassError( false, infoString(member) + " is not defined" + analyzer.varNotice(member)) } else if ((member hasFlag ABSOVERRIDE) && member.isIncompleteIn(clazz)) { @@ -449,7 +459,11 @@ abstract class RefChecks extends InfoTransform { if (!parents.isEmpty && parents.head.typeSymbol.hasFlag(ABSTRACT)) checkNoAbstractDecls(parents.head.typeSymbol) } - if (!(clazz hasFlag ABSTRACT)) checkNoAbstractDecls(clazz) + if (abstractErrors.isEmpty && !isClazzAbstract) + checkNoAbstractDecls(clazz) + + if (abstractErrors.nonEmpty) + unit.error(clazz.pos, abstractErrorMessage) } /** Returns whether there is a symbol declared in class `inclazz` diff --git a/src/library/scala/reflect/generic/AnnotationInfos.scala b/src/library/scala/reflect/generic/AnnotationInfos.scala index cc6c909a45..6239ca189c 100755 --- a/src/library/scala/reflect/generic/AnnotationInfos.scala +++ b/src/library/scala/reflect/generic/AnnotationInfos.scala @@ -20,9 +20,6 @@ trait AnnotationInfos { self: Universe => type ArrayAnnotArg <: ClassfileAnnotArg val ArrayAnnotArg: ArrayAnnotArgExtractor - type ScalaSigBytes <: ClassfileAnnotArg - val ScalaSigBytes: ScalaSigBytesExtractor - type NestedAnnotArg <: ClassfileAnnotArg val NestedAnnotArg: NestedAnnotArgExtractor @@ -36,11 +33,6 @@ trait AnnotationInfos { self: Universe => def unapply(arg: ArrayAnnotArg): Option[Array[ClassfileAnnotArg]] } - abstract class ScalaSigBytesExtractor { - def apply(bytes: Array[Byte]): ScalaSigBytes - def unapply(arg: ScalaSigBytes): Option[Array[Byte]] - } - abstract class NestedAnnotArgExtractor { def apply(anninfo: AnnotationInfo): NestedAnnotArg def unapply(arg: NestedAnnotArg): Option[AnnotationInfo] diff --git a/test/files/neg/bug2213.check b/test/files/neg/bug2213.check new file mode 100644 index 0000000000..b24f7dc554 --- /dev/null +++ b/test/files/neg/bug2213.check @@ -0,0 +1,15 @@ +bug2213.scala:9: error: class C needs to be abstract, since: +value y in class A of type Int is not defined +value x in class A of type Int is not defined +method g in class A of type => Int is not defined +method f in class A of type => Int is not defined +class C extends A {} + ^ +bug2213.scala:11: error: object creation impossible, since: +value y in class A of type Int is not defined +value x in class A of type Int is not defined +method g in class A of type => Int is not defined +method f in class A of type => Int is not defined +object Q extends A { } + ^ +two errors found diff --git a/test/files/neg/bug2213.scala b/test/files/neg/bug2213.scala new file mode 100644 index 0000000000..af1df3ccfe --- /dev/null +++ b/test/files/neg/bug2213.scala @@ -0,0 +1,11 @@ +abstract class A { + def f: Int + def g: Int + + val x: Int + val y: Int +} + +class C extends A {} + +object Q extends A { }
\ No newline at end of file diff --git a/test/files/neg/bug856.check b/test/files/neg/bug856.check index e1d0801c5f..168855d6a2 100644 --- a/test/files/neg/bug856.check +++ b/test/files/neg/bug856.check @@ -1,4 +1,6 @@ -bug856.scala:3: error: class ComplexRect needs to be abstract, since method _2 in trait Product2 of type => Double is not defined +bug856.scala:3: error: class ComplexRect needs to be abstract, since: +method _2 in trait Product2 of type => Double is not defined +method canEqual in trait Equals of type (that: Any)Boolean is not defined class ComplexRect(val _1:Double, _2:Double) extends Complex { ^ one error found |