summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala11
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/RefChecks.scala20
-rw-r--r--src/library/scala/collection/immutable/Tree.scala52
-rw-r--r--src/library/scala/collection/mutable/HashTable.scala2
5 files changed, 81 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
index 09b0f6ca2a..ef2248be02 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala
@@ -423,7 +423,7 @@ abstract class ClassfileParser {
sawPrivateConstructor = true
in.skip(2); skipAttributes()
} else {
- if ((jflags & JAVA_ACC_BRIDGE) != 0 && global.settings.target.value == "jvm-1.5")
+ if ((jflags & JAVA_ACC_BRIDGE) != 0)
sflags |= BRIDGE
if ((sflags & PRIVATE) != 0 && global.settings.XO.value) {
in.skip(4); skipAttributes()
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index dcaea1041b..10d226ace2 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -569,7 +569,10 @@ trait Namers { self: Analyzer =>
} else {
enterValueParams(meth, vparamss)
}
- if (tpt.isEmpty && meth.name == nme.CONSTRUCTOR) tpt.tpe = context.enclClass.owner.tpe
+ if (tpt.isEmpty && meth.name == nme.CONSTRUCTOR) {
+ tpt.tpe = context.enclClass.owner.tpe
+ tpt setPos meth.pos
+ }
if (onlyPresentation)
methodArgumentNames(meth) = vparamss.map(_.map(_.symbol));
@@ -673,6 +676,7 @@ trait Namers { self: Analyzer =>
for (vparam <- vparams) {
if (vparam.tpt.isEmpty) {
vparam.tpt.tpe = pfs.head
+ vparam.tpt setPos vparam.pos
vparam.symbol setInfo pfs.head
}
pfs = pfs.tail
@@ -705,9 +709,10 @@ trait Namers { self: Analyzer =>
if (tpt.isEmpty) {
val pt = resultPt.substSym(tparamSyms, tparams map (_.symbol))
tpt.tpe = widenIfNotFinal(meth, typer.computeType(rhs, pt), pt)
+ tpt setPos meth.pos
tpt.tpe
} else typer.typedType(tpt).tpe)
- }
+ }
/** If `sym' is an implicit value, check that its type signature `tp' is contractive.
* This means: The type of every implicit parameter is properly contained
@@ -840,6 +845,7 @@ trait Namers { self: Analyzer =>
sym,
newTyper(typer1.context.make(vdef, sym)).computeType(rhs, WildcardType),
WildcardType)
+ tpt setPos vdef.pos
tpt.tpe
}
} else typer1.typedType(tpt).tpe
@@ -947,6 +953,7 @@ trait Namers { self: Analyzer =>
checkNoConflict(FINAL, SEALED)
checkNoConflict(PRIVATE, PROTECTED)
checkNoConflict(PRIVATE, OVERRIDE)
+ //checkNoConflict(PRIVATE, FINAL) // can't do this because FINAL also means compile-time constant
checkNoConflict(DEFERRED, FINAL)
}
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
index de1f3f3119..d22ab4942e 100644
--- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
@@ -249,8 +249,20 @@ abstract class RefChecks extends InfoTransform {
else clazz.toString() + " needs to be abstract") + ", since " + msg);
clazz.setFlag(ABSTRACT)
}
+ // Find a concrete Java method that overrides `sym' under the erasure model.
+ // Bridge symbols qualify.
+ // Used as a fall back if no overriding symbol of a Java abstract method can be found
+ def javaErasedOverridingSym(sym: Symbol): Symbol =
+ clazz.tpe.findMember(sym.name, PRIVATE, 0, false).filter(other =>
+ !other.isDeferred &&
+ (other hasFlag JAVA) && {
+ val tp1 = erasure.erasure(clazz.thisType.memberType(sym))
+ val tp2 = erasure.erasure(clazz.thisType.memberType(other))
+ atPhase(currentRun.erasurePhase.next)(tp1 matches tp2)
+ })
for (val member <- clazz.tpe.nonPrivateMembers)
- if (member.isDeferred && !(clazz hasFlag ABSTRACT)) {
+ if (member.isDeferred && !(clazz hasFlag ABSTRACT) &&
+ !((member hasFlag JAVA) && javaErasedOverridingSym(member) != NoSymbol)) {
abstractClassError(
false, infoString(member) + " is not defined" + analyzer.varNotice(member))
} else if ((member hasFlag ABSOVERRIDE) && member.isIncompleteIn(clazz)) {
@@ -263,6 +275,12 @@ abstract class RefChecks extends InfoTransform {
}
// 3. Check that concrete classes do not have deferred definitions
// that are not implemented in a subclass.
+ // Note that this is not the same as (2); In a situation like
+ //
+ // class C { def m: Int = 0}
+ // class D extends C { def m: Int }
+ //
+ // (3) is violated but not (2).
def checkNoAbstractDecls(bc: Symbol) {
for (val decl <- bc.info.decls.elements) {
if (decl.isDeferred) {
diff --git a/src/library/scala/collection/immutable/Tree.scala b/src/library/scala/collection/immutable/Tree.scala
index 3853e23cd9..0ce6469952 100644
--- a/src/library/scala/collection/immutable/Tree.scala
+++ b/src/library/scala/collection/immutable/Tree.scala
@@ -17,7 +17,10 @@
** Balanced Trees. These have no storage overhead compared to plain
** unbalanced binary trees, and their performance is in general better
** than AVL trees.
-*
+**
+** NOTE: This code was until 2007-04-01 under a GPL license. The author has
+** given permission to remove that license, so that now this code is under
+** the general license for the Scala libraries.
*/
package scala.collection.immutable
@@ -387,3 +390,50 @@ private case class GBNode[A <% Ordered[A],B](key: A,
override def hashCode() =
value.hashCode() + smaller.hashCode() + bigger.hashCode()
}
+
+/* Here is the e-mail where the Author agreed to the change in license.
+
+from Erik Stenman <happi.stenman@gmail.com>
+to martin odersky <martin.odersky@epfl.ch>,
+date Tue, Apr 29, 2008 at 3:31 PM
+subject Re: test
+mailed-by chara.epfl.ch
+signed-by gmail.com
+
+Hi Martin,
+
+I am fine with that change, and since I don't have a scala distribution handy,
+I am also fine with you doing the change yourself. Is that OK?
+
+Sorry for my dead home address, I'll add an English response to it at some time.
+
+I am doing fine, and my family is also doing fine.
+Hope all is well with you too.
+
+Cheers,
+Erik
+- Hide quoted text -
+
+On Tue, Apr 29, 2008 at 3:13 PM, martin odersky <martin.odersky@epfl.ch> wrote:
+
+ Hi Erik,
+
+ I tried to send mail to happi@home.se, but got a response n swedish. I
+ was sort of guessing from the response that it contained an
+ alternative e-mail address and tried to send it there.
+
+ Anyway, I hope things are going well with you!
+
+ There was some discussion recently about the license of Tree.scala in
+ package collection.immutable. It's GPL, whereas the rest of the Scala
+ library is BSD. It seems this poses problems with Scala being packaged
+ with Fedora. Would it be OK with you to change the license to the
+ general one of Scala libraries? You could simply remove the references
+ to the GPL
+ license in the code and send it back to me if that's OK with you. On
+ the other hand, if there's a problem we'll try something else instead.
+
+ All the best
+
+ -- Martin
+*/
diff --git a/src/library/scala/collection/mutable/HashTable.scala b/src/library/scala/collection/mutable/HashTable.scala
index 214166e823..fb9ce91c58 100644
--- a/src/library/scala/collection/mutable/HashTable.scala
+++ b/src/library/scala/collection/mutable/HashTable.scala
@@ -43,7 +43,7 @@ trait HashTable[A] extends AnyRef {
/** The initial threshold
*/
- protected val initialThreshold: Int = newThreshold(initialSize)
+ protected def initialThreshold: Int = newThreshold(initialSize)
/** The actual hash table.
*/