summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Cunei <antonio.cunei@epfl.ch>2010-05-02 09:35:37 +0000
committerAntonio Cunei <antonio.cunei@epfl.ch>2010-05-02 09:35:37 +0000
commit4e4e1e4c759c14fbc45f92072b692fa3b9540ba0 (patch)
tree3ba88bc75b71a3fe64f62a3bc8e6ac680abea09e
parent660683929b6346d7a316273c145c677db7118e7d (diff)
downloadscala-4e4e1e4c759c14fbc45f92072b692fa3b9540ba0.tar.gz
scala-4e4e1e4c759c14fbc45f92072b692fa3b9540ba0.tar.bz2
scala-4e4e1e4c759c14fbc45f92072b692fa3b9540ba0.zip
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. ........
-rw-r--r--build.xml6
-rw-r--r--src/compiler/scala/tools/nsc/symtab/AnnotationInfos.scala1
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala28
-rwxr-xr-xsrc/library/scala/reflect/generic/AnnotationInfos.scala8
-rw-r--r--test/files/neg/bug2213.check15
-rw-r--r--test/files/neg/bug2213.scala11
-rw-r--r--test/files/neg/bug856.check4
7 files changed, 53 insertions, 20 deletions
diff --git a/build.xml b/build.xml
index 65ff3e684b..58373ea69b 100644
--- a/build.xml
+++ b/build.xml
@@ -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