Skip to content

Commit

Permalink
UnusedPrivateMember: fix false positive with backtick parameters (#5252)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-kameyama committed Aug 29, 2022
1 parent 2866976 commit 1a60429
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -258,7 +258,7 @@ private class UnusedParameterVisitor(allowedNames: Regex) : UnusedMemberVisitor(
}

override fun visitReferenceExpression(expression: KtReferenceExpression) {
parameters.remove(expression.text)
parameters.remove(expression.text.removeSurrounding("`"))
super.visitReferenceExpression(expression)
}
})
Expand Down
Expand Up @@ -1468,6 +1468,17 @@ class UnusedPrivateMemberSpec(val env: KotlinCoreEnvironment) {
}
}

@Nested
inner class `backtick identifiers - #5251` {
@Test
fun `does not report used backtick parameters`() {
val code = """
fun test(`foo bar`: Int) = `foo bar`
"""
assertThat(subject.compileAndLintWithContext(env, code)).isEmpty()
}
}

@Nested
inner class `list get overloaded operator function - #3640` {
@Test
Expand Down

0 comments on commit 1a60429

Please sign in to comment.