diff options
author | Martin Odersky <odersky@gmail.com> | 2012-07-31 16:09:06 +0200 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2012-09-03 12:23:07 +0200 |
commit | dc1e21e21708428a6f9d3cc561f9b04784d47c53 (patch) | |
tree | 79eb833e3439f1a19cd2a74e3dddb1f0f8ed22db | |
parent | 6abd9f5f55d7d265f0606942dabaa0124f398fa1 (diff) | |
download | scala-dc1e21e21708428a6f9d3cc561f9b04784d47c53.tar.gz scala-dc1e21e21708428a6f9d3cc561f9b04784d47c53.tar.bz2 scala-dc1e21e21708428a6f9d3cc561f9b04784d47c53.zip |
Added more variants to achieve getLinkPos
getLinkPos is known to be flakey. This commit tries some variants and logs what failed.
(cherry picked from commit 848756d47b980472996cd83409bda11f8fb5cac0)
Conflicts:
src/compiler/scala/tools/nsc/interactive/Global.scala
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 67e3a0ec32..886d6b2c2e 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -747,13 +747,23 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "") val originalTypeParams = sym.owner.typeParams parseAndEnter(unit) val pre = adaptToNewRunMap(ThisType(sym.owner)) - val newsym = pre.typeSymbol.info.decl(sym.name) filter { alt => + val rawsym = pre.typeSymbol.info.decl(sym.name) + val newsym = rawsym filter { alt => sym.isType || { try { val tp1 = pre.memberType(alt) onTypeError NoType val tp2 = adaptToNewRunMap(sym.tpe) substSym (originalTypeParams, sym.owner.typeParams) - matchesType(tp1, tp2, false) - } catch { + matchesType(tp1, tp2, false) || { + debugLog("getLinkPos matchesType(" + tp1 + ", " + tp2 + ") failed") + val tp3 = adaptToNewRunMap(sym.tpe) substSym (originalTypeParams, alt.owner.typeParams) + matchesType(tp1, tp3, false) || { + debugLog("getLinkPos fallback matchesType(" + tp1 + ", " + tp3 + ") failed") + false + } + } + } + catch { + case ex: ControlThrowable => throw ex case ex: Throwable => println("error in hyperlinking: " + ex) ex.printStackTrace() @@ -762,8 +772,11 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "") } } if (newsym == NoSymbol) { - debugLog("link not found " + sym + " " + source + " " + pre) - NoPosition + if (rawsym.exists && !rawsym.isOverloaded) rawsym.pos + else { + debugLog("link not found " + sym + " " + source + " " + pre) + NoPosition + } } else if (newsym.isOverloaded) { settings.uniqid.value = true debugLog("link ambiguous " + sym + " " + source + " " + pre + " " + newsym.alternatives) |