Skip to content

Commit

Permalink
better support of backquoted identifiers in SymbolMatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Nov 6, 2023
1 parent 3f44fad commit 515388d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ object SymbolOps {
}

def inferTrailingDot(symbol: String): String =
if (symbol.isEmpty) symbol
else if (Character.isJavaIdentifierPart(symbol.last)) symbol + "."
else symbol
if (symbol.isEmpty)
symbol
else if (Character.isJavaIdentifierPart(symbol.last) || symbol.last == '`')
symbol + "."
else
symbol
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ class SymbolMatcherSuite extends AnyFunSuite {
assert(map.matches(Symbol("scala/Option#map(+1).")), sym)
assert(map.matches(Symbol("scala/Option.map(+1).")), sym)
}

List(
"scala.Int.`+`",
"scala.Int.`+`#",
"scala.Int.`+`."
).foreach { sym =>
val option = SymbolMatcher.normalized(sym)
assert(option.matches(Symbol("scala/Int#`+`(+4).")), sym)
}
}

test("matches/unapply") {
Expand Down

0 comments on commit 515388d

Please sign in to comment.