Skip to content

Commit

Permalink
Merge pull request #1828 from olafurpg/range
Browse files Browse the repository at this point in the history
Guard `Position.start` against `NoPosition`
  • Loading branch information
olafurpg committed Feb 2, 2019
2 parents 7602bcd + 582ffb7 commit dc639c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -313,7 +313,7 @@ trait SymbolOps { self: SemanticdbOps =>
val minput = loop(sym).toInput
if (minput == m.Input.None) Symbols.None
else {
val hasPosition = sym.pos.isDefined
val hasPosition = sym.pos != null && sym.pos.isDefined
val conflict =
if (hasPosition) pointsCache.get(sym.pos.point)
else null
Expand Down
Expand Up @@ -630,7 +630,11 @@ trait TextDocumentOps { self: SemanticdbOps =>
case gtree: g.MemberDef =>
gtree.symbol.annotations.foreach(ann => traverse(ann.original))
tryFindMtree(gtree)
if (!gtree.symbol.isSynthetic && msinglevalpats.contains(gtree.pos.start)) {
if (gtree.symbol != null &&
!gtree.symbol.isSynthetic &&
gtree.pos != null &&
gtree.pos.isRange &&
msinglevalpats.contains(gtree.pos.start)) {
// Map Defn.Val position of val pattern with single binder to the position
// of the single binder. For example, map `val Foo(x) = ..` to the position of `x`.
val mpos = msinglevalpats(gtree.pos.start)
Expand All @@ -639,7 +643,9 @@ trait TextDocumentOps { self: SemanticdbOps =>
}
case _: g.Apply | _: g.TypeApply =>
tryFindSynthetic(gtree)
tryNamedArg(gtree, gtree.pos.start, gtree.pos.point)
if (gtree.pos != null && gtree.pos.isRange) {
tryNamedArg(gtree, gtree.pos.start, gtree.pos.point)
}
case select: g.Select if isSyntheticName(select) =>
tryFindMtree(select.qualifier)
tryFindSynthetic(select)
Expand Down

0 comments on commit dc639c8

Please sign in to comment.