Skip to content

Commit 2c4ed0b

Browse files
committed
Merge commit '7c1d114' into merge-2.10.x-to-master
Conflicts: src/compiler/scala/tools/nsc/interactive/Global.scala
2 parents fa0c95b + 7c1d114 commit 2c4ed0b

File tree

7 files changed

+71
-9
lines changed

7 files changed

+71
-9
lines changed

src/interactive/scala/tools/nsc/interactive/Global.scala

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,12 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
327327
* @param result The transformed node
328328
*/
329329
override def signalDone(context: Context, old: Tree, result: Tree) {
330-
if (interruptsEnabled && analyzer.lockedCount == 0) {
330+
val canObserveTree = (
331+
interruptsEnabled
332+
&& analyzer.lockedCount == 0
333+
&& !context.bufferErrors // SI-7558 look away during exploratory typing in "silent mode"
334+
)
335+
if (canObserveTree) {
331336
if (context.unit.exists &&
332337
result.pos.isOpaqueRange &&
333338
(result.pos includes context.unit.targetPos)) {
@@ -338,14 +343,16 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "")
338343
}
339344
throw new TyperResult(located)
340345
}
341-
try {
342-
checkForMoreWork(old.pos)
343-
} catch {
344-
case ex: ValidateException => // Ignore, this will have been reported elsewhere
345-
debugLog("validate exception caught: "+ex)
346-
case ex: Throwable =>
347-
log.flush()
348-
throw ex
346+
else {
347+
try {
348+
checkForMoreWork(old.pos)
349+
} catch {
350+
case ex: ValidateException => // Ignore, this will have been reported elsewhere
351+
debugLog("validate exception caught: "+ex)
352+
case ex: Throwable =>
353+
log.flush()
354+
throw ex
355+
}
349356
}
350357
}
351358
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(x: Int)Unit
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import scala.tools.nsc.interactive.tests.InteractiveTest
2+
3+
object Test extends InteractiveTest {
4+
override protected def loadSources() { /* don't parse or typecheck sources */ }
5+
6+
import compiler._
7+
8+
override def runDefaultTests() {
9+
val res = new Response[Tree]
10+
val pos = compiler.rangePos(sourceFiles.head, 102,102,102)
11+
compiler.askTypeAt(pos, res)
12+
res.get match {
13+
case Left(tree) => compiler.ask(() => reporter.println(tree.tpe))
14+
case Right(ex) => reporter.println(ex)
15+
}
16+
}
17+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
object Foo {
2+
def foo(x: Int) = {}
3+
def foo(x: String) = {}
4+
def foo(x: Int, y: String) = {}
5+
6+
foo(2)
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Foo.this.I2BI(Foo.this.I).+: (other: Foo.BI.type)Unit
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import scala.tools.nsc.interactive.tests.InteractiveTest
2+
3+
object Test extends InteractiveTest {
4+
override protected def loadSources() { /* don't parse or typecheck sources */ }
5+
6+
import compiler._
7+
8+
override def runDefaultTests() {
9+
val res = new Response[Tree]
10+
val pos = compiler.rangePos(sourceFiles.head, 191, 191, 191) // +
11+
compiler.askTypeAt(pos, res)
12+
res.get match {
13+
case Left(tree) => compiler.ask(() => reporter.println(s"$tree: ${tree.tpe}"))
14+
case Right(ex) => reporter.println(ex)
15+
}
16+
}
17+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import language._
2+
3+
object Foo {
4+
object I {
5+
def +(other: I.type) : Unit = ()
6+
}
7+
object BI {
8+
def +(other: BI.type): Unit = ()
9+
}
10+
implicit def I2BI(i: I.type): BI.type = BI
11+
I.+(BI)
12+
}

0 commit comments

Comments
 (0)