Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

SI-7458 Pres. compiler must not observe trees in silent mode

Otherwise we can think that `+` in `1 + BigInt(2)` refers
to a method in `Int`.

In general, this protects the IDE from observing results from
"exploratory" typing which is discarded as the compiler backtracks
to another possibility.

This protection subsumes the condition that checked for overloaded
types: presentation/t7458 now passes without this.
  • Loading branch information...
commit 02308c96910a76a09c2654db304a0696c0b603af 1 parent 652b3b4
@retronym retronym authored dotta committed
View
12 src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -238,7 +238,12 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
* @param result The transformed node
*/
override def signalDone(context: Context, old: Tree, result: Tree) {
- if (interruptsEnabled && analyzer.lockedCount == 0) {
+ val canObserveTree = (
+ interruptsEnabled
+ && analyzer.lockedCount == 0
+ && !context.bufferErrors // SI-7558 look away during exploratory typing in "silent mode"
+ )
+ if (canObserveTree) {
if (context.unit.exists &&
result.pos.isOpaqueRange &&
(result.pos includes context.unit.targetPos)) {
@@ -247,10 +252,7 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
println("something's wrong: no "+context.unit+" in "+result+result.pos)
located = result
}
- located.tpe match {
- case _: OverloadedType => ()
- case _ => throw new TyperResult(located)
- }
+ throw new TyperResult(located)
}
else {
try {
View
2  test/files/presentation/t7548b.check
@@ -1 +1 @@
-Foo.this.I.+: (other: Foo.I.type)Unit
+Foo.this.I2BI(Foo.this.I).+: (other: Foo.BI.type)Unit
Please sign in to comment.
Something went wrong with that request. Please try again.