summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2006-07-04 11:57:47 +0000
committerMartin Odersky <odersky@gmail.com>2006-07-04 11:57:47 +0000
commit2568aebb5aac69629c77c49651815ae8b993cffc (patch)
treedd15288b32f39e2bdcf2d881d9b7a1cb9f112b73
parentfe0436c6f94b8f113e710f183ccc39d9d6030e89 (diff)
downloadscala-2568aebb5aac69629c77c49651815ae8b993cffc.tar.gz
scala-2568aebb5aac69629c77c49651815ae8b993cffc.tar.bz2
scala-2568aebb5aac69629c77c49651815ae8b993cffc.zip
Fixed bug648
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala14
-rwxr-xr-xsrc/library/scala/runtime/RichString.scala2
2 files changed, 13 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 5ecda5069f..92e87f85cf 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -578,6 +578,7 @@ trait Typers requires Analyzer {
}
} catch {
case ex: TypeError =>
+ templ.tpe = null
reportTypeError(templ.pos, ex)
List(TypeTree(AnyRefClass.tpe))
}
@@ -886,6 +887,11 @@ trait Typers requires Analyzer {
}
def typedBlock(block: Block, mode: int, pt: Type): Block = {
+ if (context.retyping) {
+ for (val stat <- block.stats) {
+ if (stat.isDef) context.scope.enter(stat.symbol)
+ }
+ }
namer.enterSyms(block.stats)
block.stats foreach enterLabelDef
val stats1 = typedStats(block.stats, context.owner)
@@ -957,6 +963,7 @@ trait Typers requires Analyzer {
}
else argpt
namer.enterSym(vparam)
+ if (context.retyping) context.scope enter vparam.symbol
vparam.symbol
}
val vparams = List.mapConserve(fun.vparams)(typedValDef)
@@ -1474,8 +1481,9 @@ trait Typers requires Analyzer {
/*
newTyper(context.makeNewScope(tree, context.owner)).typedFunction(fun, mode, pt)
*/
- tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME)
- .setFlag(SYNTHETIC).setInfo(NoType)
+ if (tree.symbol == NoSymbol)
+ tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME)
+ .setFlag(SYNTHETIC).setInfo(NoType)
newTyper(context.makeNewScope(tree, tree.symbol)).typedFunction(fun, mode, pt)
case Assign(lhs, rhs) =>
@@ -1608,6 +1616,7 @@ trait Typers requires Analyzer {
phase.id <= currentRun.typerPhase.id &&
fun1.isInstanceOf[Select] &&
!fun1.tpe.isInstanceOf[ImplicitMethodType] &&
+ (fun1.symbol == null || !fun1.symbol.isConstructor) &&
(mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun1, args)
else {
typedApply(tree, fun1, args, mode, pt)
@@ -1739,6 +1748,7 @@ trait Typers requires Analyzer {
result
} catch {
case ex: TypeError =>
+ tree.tpe = null
//System.out.println("caught "+ex+" in typed");//DEBUG
reportTypeError(tree.pos, ex)
setError(tree)
diff --git a/src/library/scala/runtime/RichString.scala b/src/library/scala/runtime/RichString.scala
index 1c4d83dbb2..44b66ce540 100755
--- a/src/library/scala/runtime/RichString.scala
+++ b/src/library/scala/runtime/RichString.scala
@@ -22,7 +22,7 @@ final class RichString(s: String) {
*/
def apply(index: Int): Char = s charAt index
- /** Strip trailing line end characters from this string
+ /** Strip trailing line end character from this string if it has one.
* A line end character is one of
* LF - line feed (0x0A hex)
* FF - form feed (0x0C hex)