diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-08-01 13:05:21 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-08-01 13:05:21 -0700 |
commit | e86e95a2434962b46ca3f9393a7f820d3f99da48 (patch) | |
tree | b58425ebd6c17e3b1c756b566d783173be2c83fd /src | |
parent | b35894c2c341f69f61a7a0eb6131c6b3d828b1a3 (diff) | |
parent | 848756d47b980472996cd83409bda11f8fb5cac0 (diff) | |
download | scala-e86e95a2434962b46ca3f9393a7f820d3f99da48.tar.gz scala-e86e95a2434962b46ca3f9393a7f820d3f99da48.tar.bz2 scala-e86e95a2434962b46ca3f9393a7f820d3f99da48.zip |
Merge pull request #1029 from odersky/ide/getlinkpos
Added more variants to achieve getLinkPos
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/interactive/Global.scala | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 27b6cae2a6..77bc77e966 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -749,12 +749,20 @@ 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) + matchesType(tp1, tp2, false) || { + debugLog(s"getLinkPos matchesType($tp1, $tp2) failed") + val tp3 = adaptToNewRunMap(sym.tpe) substSym (originalTypeParams, alt.owner.typeParams) + matchesType(tp1, tp3, false) || { + debugLog(s"getLinkPos fallback matchesType($tp1, $tp3) failed") + false + } + } } catch { case ex: ControlThrowable => throw ex @@ -766,8 +774,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) |