From 0250956d2dab3df8d8c72a94fbc886bf655dc690 Mon Sep 17 00:00:00 2001 From: Miles Sabin Date: Thu, 10 Sep 2009 18:06:45 +0000 Subject: Make sure that last fix is only applied in inte... Make sure that last fix is only applied in interactive mode. --- .../scala/tools/nsc/typechecker/Typers.scala | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 99b10d766d..fef0dd0282 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3216,14 +3216,21 @@ trait Typers { self: Analyzer => "\npossible cause: maybe a semicolon is missing before `"+decode(name)+"'?" else "")) } - setError(tree) - val tree1 = tree match { - case Select(_, _) => treeCopy.Select(tree, qual, name) - case SelectFromTypeTree(_, _) => treeCopy.SelectFromTypeTree(tree, qual, name) - } - - tree1 + // Temporary workaround to retain type information for qual so that askTypeCompletion has something to + // work with. This appears to work in the context of the IDE, but is incorrect and needs to be + // revisited. + if (onlyPresentation) { + // Nb. this appears to throw away the effects of setError, but some appear to be + // retained across the copy. + setError(tree) + val tree1 = tree match { + case Select(_, _) => treeCopy.Select(tree, qual, name) + case SelectFromTypeTree(_, _) => treeCopy.SelectFromTypeTree(tree, qual, name) + } + tree1 + } else + setError(tree) } else { val tree1 = tree match { case Select(_, _) => treeCopy.Select(tree, qual, name) -- cgit v1.2.3