From 4e4e1e4c759c14fbc45f92072b692fa3b9540ba0 Mon Sep 17 00:00:00 2001 From: Antonio Cunei Date: Sun, 2 May 2010 09:35:37 +0000 Subject: Merged revisions 21765-21767,21771 via svnmerge... Merged revisions 21765-21767,21771 via svnmerge from https://lampsvn.epfl.ch/svn-repos/scala/scala/trunk ........ r21765 | extempore | 2010-04-30 16:41:33 +0200 (Fri, 30 Apr 2010) | 1 line Kicked partest up to a 6 hour timeout. No review. ........ r21766 | dubochet | 2010-04-30 19:22:59 +0200 (Fri, 30 Apr 2010) | 1 line Removed AnnotationInfos.ScalaSigBytes from reflect.generic, as it is an implementation detail of the compiler and shouldn't be part of a public API. Review by odersky. ........ r21767 | extempore | 2010-04-30 23:17:56 +0200 (Fri, 30 Apr 2010) | 2 lines Accumulate missing abstract member errors so they can all be printed instead of only the first. Closes #2213, no review. ........ r21771 | extempore | 2010-05-01 19:17:56 +0200 (Sat, 01 May 2010) | 3 lines Kicked the partest timeouts way up since apparently even 6 hours isn't enough for windows to complete. Don't know what the deal is there, let's see if 10 hours is enough. No review. ........ --- .../scala/tools/nsc/symtab/AnnotationInfos.scala | 1 - .../scala/tools/nsc/typechecker/RefChecks.scala | 28 ++++++++++++++++------ .../scala/reflect/generic/AnnotationInfos.scala | 8 ------- 3 files changed, 21 insertions(+), 16 deletions(-) (limited to 'src') 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] -- cgit v1.2.3