Rename: Do not suggest camel names for backquoted non-identifiers

#KT-22888 Fixed
This commit is contained in:
Alexey Sedunov
2018-03-26 15:31:46 +03:00
parent ea66e1e3f7
commit e5b915661a
3 changed files with 14 additions and 1 deletions
@@ -228,7 +228,7 @@ object KotlinNameSuggester {
}
private fun MutableCollection<String>.addCamelNames(name: String, validator: (String) -> Boolean, startLowerCase: Boolean = true) {
if (name === "") return
if (name === "" || !name.unquote().isIdentifier()) return
var s = extractIdentifiers(name)
for (prefix in ACCESSOR_PREFIXES) {
@@ -0,0 +1,11 @@
fun `should receive message from subscribed category`() {
}
fun test() {
<selection>`should receive message from subscribed category`</selection>()
}
/*
value
*/
@@ -75,6 +75,8 @@ class KotlinNameSuggesterTest : KotlinLightCodeInsightFixtureTestCase() {
fun testExtensionFunction2() = doTest()
fun testNoCamelNamesForBacktickedNonId() = doTest()
override fun getTestDataPath(): String {
return PluginTestCaseBase.getTestDataPathBase() + "/refactoring/nameSuggester"
}