summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2008-08-17 20:34:21 +0000
committerMartin Odersky <odersky@gmail.com>2008-08-17 20:34:21 +0000
commit5cc825c48d3b9bf806d41195e0954b9a2ff2fc3f (patch)
treea20091811b299cdd8a5ad5d681d716a9f0a1e795 /src
parentef642a8a511436e9bbf4d7bd243d8e367d77f864 (diff)
downloadscala-5cc825c48d3b9bf806d41195e0954b9a2ff2fc3f.tar.gz
scala-5cc825c48d3b9bf806d41195e0954b9a2ff2fc3f.tar.bz2
scala-5cc825c48d3b9bf806d41195e0954b9a2ff2fc3f.zip
Fixed #1186, #1230
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/CompilationUnits.scala2
-rw-r--r--src/compiler/scala/tools/nsc/transform/Erasure.scala3
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala16
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala2
4 files changed, 12 insertions, 11 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilationUnits.scala b/src/compiler/scala/tools/nsc/CompilationUnits.scala
index 3bac2f7525..f536a16a62 100644
--- a/src/compiler/scala/tools/nsc/CompilationUnits.scala
+++ b/src/compiler/scala/tools/nsc/CompilationUnits.scala
@@ -73,7 +73,7 @@ trait CompilationUnits { self: Global =>
}
/** Is this about a .java source file? */
- def isJava = source.file.name.endsWith(".java")
+ lazy val isJava = source.file.name.endsWith(".java")
override def toString() = source.toString()
diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala
index 4c65f76c97..817c9bb658 100644
--- a/src/compiler/scala/tools/nsc/transform/Erasure.scala
+++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala
@@ -208,7 +208,8 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer {
case tp => List(tp)
}
def boundSig(bounds: List[Type]) = {
- val classBound = bounds find (t => t.typeSymbol.isClass && !t.typeSymbol.isTrait) match {
+ def isClassBound(t: Type) = t.typeSymbol.isClass || t.typeSymbol.isAbstractType
+ val classBound = bounds find isClassBound match {
case Some(t) => javaSig(t)
case None => ""
}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index f6e6d4ef22..54ddcdb25d 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -330,12 +330,16 @@ trait Namers { self: Analyzer =>
finish
case ValDef(mods, name, tp, rhs) =>
- if (name.endsWith(nme.OUTER, nme.OUTER.length)) { // SM
+ if ((!context.owner.isClass ||
+ (mods.flags & (PRIVATE | LOCAL)) == (PRIVATE | LOCAL) ||
+ name.endsWith(nme.OUTER, nme.OUTER.length) ||
+ context.unit.isJava) &&
+ (mods.flags & LAZY) == 0) {
tree.symbol = enterInScope(owner.newValue(tree.pos, name)
.setFlag(mods.flags))
finish
- } else if (context.owner.isClass && (mods.flags & (PRIVATE | LOCAL)) != (PRIVATE | LOCAL)
- || (mods.flags & LAZY) != 0) {
+ } else {
+ // add getter and possibly also setter
val accflags: Long = ACCESSOR |
(if ((mods.flags & MUTABLE) != 0) mods.flags & ~MUTABLE & ~PRESUPER
else mods.flags & ~PRESUPER | STABLE)
@@ -367,11 +371,7 @@ trait Namers { self: Analyzer =>
if ((mods.flags & LAZY) != 0)
vsym.setLazyAccessor(getter)
vsym
- } else getter;
- } else {
- tree.symbol = enterInScope(owner.newValue(tree.pos, name)
- .setFlag(mods.flags))
- finish
+ } else getter
}
case DefDef(mods, nme.CONSTRUCTOR, tparams, _, _, _) =>
var sym = owner.newConstructor(tree.pos).setFlag(mods.flags | owner.getFlag(ConstrFlags))
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 014676199f..79621e00fe 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -1540,7 +1540,7 @@ trait Typers { self: Analyzer =>
stats1
}
- def typedImport(imp : Import) : Import = imp;
+ def typedImport(imp : Import) : Import = imp
def typedStats(stats: List[Tree], exprOwner: Symbol): List[Tree] = {