For a given global.Symbol, .sourceFile may return null, whereas pos.source (when the latter is defined) returns a value. Quite certainly a small compiler quirk. Right now the code only looks at .sourceFile. Observed for https://github.com/allenai/pipeline.
So in those cases (seems to be rare) where only pos.source has the path, then we likely miss out on correlating a symbol to a given source and location. Worst, as it currently stands we also deduce whether a symbol is external v.s. project-defined by this value.
So we should likely grab .pos.source if it has something, when .sourceFile does not - everywhere that the latter is currently being used. Which means wrap this all as our own getSourcePath(global.Symbol): Option[String] method somewhere.
Note that for debug, .pos itself is not always defined, so .pos.source shouldn't be attempted except when .pos is defined. So precede if (symbol.pos.toString == "NoPosition") to it.
For a given
global.Symbol
,.sourceFile
may return null, whereaspos.source
(when the latter is defined) returns a value. Quite certainly a small compiler quirk. Right now the code only looks at.sourceFile
. Observed for https://github.com/allenai/pipeline.So in those cases (seems to be rare) where only
pos.source
has the path, then we likely miss out on correlating a symbol to a given source and location. Worst, as it currently stands we also deduce whether a symbol is external v.s. project-defined by this value.So we should likely grab
.pos.source
if it has something, when.sourceFile
does not - everywhere that the latter is currently being used. Which means wrap this all as our owngetSourcePath(global.Symbol): Option[String]
method somewhere.