diff options
author | Adriaan Moors <adriaan@lightbend.com> | 2017-03-27 17:11:09 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-27 17:11:09 -0700 |
commit | 03d5f4ee9242f048e86ad9196740b04852c3b738 (patch) | |
tree | 2f629f7e8cd6bc22bf839516e36a9d631e9351b9 /src/compiler/scala/tools/nsc/Global.scala | |
parent | 99f41a15d16be6707b6c33b5a16093e016db81eb (diff) | |
parent | 9cfa239e776c2ce6bd7447fd9de8436c5fe167ab (diff) | |
download | scala-03d5f4ee9242f048e86ad9196740b04852c3b738.tar.gz scala-03d5f4ee9242f048e86ad9196740b04852c3b738.tar.bz2 scala-03d5f4ee9242f048e86ad9196740b04852c3b738.zip |
Merge pull request #5804 from jvican/stub-errors-2.11.8
Backport 2.11.9: Improve stub error messages (SCP-009 proposal)
Diffstat (limited to 'src/compiler/scala/tools/nsc/Global.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/Global.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 8d72fd76bd..a54b92cef8 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -96,6 +96,20 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def erasurePhase: Phase = if (currentRun.isDefined) currentRun.erasurePhase else NoPhase + /* Override `newStubSymbol` defined in `SymbolTable` to provide us access + * to the last tree to typer, whose position is the trigger of stub errors. */ + override def newStubSymbol(owner: Symbol, + name: Name, + missingMessage: String, + isPackage: Boolean = false): Symbol = { + val stubSymbol = super.newStubSymbol(owner, name, missingMessage, isPackage) + val stubErrorPosition = { + val lastTreeToTyper = analyzer.lastTreeToTyper + if (lastTreeToTyper != EmptyTree) lastTreeToTyper.pos else stubSymbol.pos + } + stubSymbol.setPos(stubErrorPosition) + } + // platform specific elements protected class GlobalPlatform extends { |