summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorMiles Sabin <miles@milessabin.com>2010-02-20 20:32:40 +0000
committerMiles Sabin <miles@milessabin.com>2010-02-20 20:32:40 +0000
commit099f42f725cf516b2bc4586e87ec11475c5f2698 (patch)
tree77350abc66d795f0e1fd9886f7ea3aa6bf2315b8 /src/compiler
parent7a339e84c2a3ad6ef4519cc2c9bda4b24d5ac999 (diff)
downloadscala-099f42f725cf516b2bc4586e87ec11475c5f2698.tar.gz
scala-099f42f725cf516b2bc4586e87ec11475c5f2698.tar.bz2
scala-099f42f725cf516b2bc4586e87ec11475c5f2698.zip
Another attempt at retaining ill-typed trees fo...
Another attempt at retaining ill-typed trees for the IDE, this time without breaking scaladoc. Review by extempore.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala32
2 files changed, 24 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 99117e014b..d8ea6df97d 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -494,7 +494,7 @@ self =>
println("starting typedTreeAt")
val tree = locateTree(pos)
println("at pos "+pos+" was found: "+tree+tree.pos.show)
- if (tree.tpe ne null) {
+ if (stabilizedType(tree) ne null) {
println("already attributed")
tree
} else {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index e39f552458..9325fa1e2b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -711,14 +711,19 @@ trait Typers { self: Analyzer =>
else qual.tpe.nonLocalMember(name)
}
- def silent[T](op: Typer => T): Any /* in fact, TypeError or T */ = {
+ def silent[T](op: Typer => T) : Any = silent(false, op)
+ def noisy[T](op: Typer => T) = silent(true, op)
+
+ def silent[T](report : Boolean, op: Typer => T): Any /* in fact, TypeError or T */ = {
val rawTypeStart = startCounter(rawTypeFailed)
val findMemberStart = startCounter(findMemberFailed)
val subtypeStart = startCounter(subtypeFailed)
val failedSilentStart = startTimer(failedSilentNanos)
try {
- if (context.reportGeneralErrors) {
- val context1 = context.makeSilent(context.reportAmbiguousErrors)
+ if (context.reportGeneralErrors != report) {
+ val context1 = context.make(context.tree)
+ context1.reportGeneralErrors = report
+ context1.reportAmbiguousErrors = context.reportAmbiguousErrors
context1.undetparams = context.undetparams
context1.savedTypeBounds = context.savedTypeBounds
context1.namedApplyBlockInfo = context.namedApplyBlockInfo
@@ -3303,12 +3308,21 @@ trait Typers { self: Analyzer =>
if (printTypings) println("second try for: "+fun+" and "+args)
val Select(qual, name) = fun
val args1 = tryTypedArgs(args, argMode(fun, mode), ex)
- val qual1 =
- if ((args1 ne null) && !pt.isError) adaptToArguments(qual, name, args1, pt)
- else qual
- if (qual1 ne qual) {
- val tree1 = Apply(Select(qual1, name) setPos fun.pos, args1) setPos tree.pos
- return typed1(tree1, mode | SNDTRYmode, pt)
+ if ((args1 eq null) && onlyPresentation) {
+ return noisy(_.doTypedApply(tree, fun, args, mode, pt)) match {
+ case t: Tree => t
+ case ex: TypeError =>
+ reportTypeError(tree.pos, ex)
+ setError(tree)
+ }
+ } else {
+ val qual1 =
+ if ((args1 ne null) && !pt.isError) adaptToArguments(qual, name, args1, pt)
+ else qual
+ if (qual1 ne qual) {
+ val tree1 = Apply(Select(qual1, name) setPos fun.pos, args1) setPos tree.pos
+ return typed1(tree1, mode | SNDTRYmode, pt)
+ }
}
} else if (printTypings) {
println("no second try for "+fun+" and "+args+" because error not in result:"+ex.pos+"!="+tree.pos)