remove PARAMETER highlight on top of INSTANCE_PROPERTY for primary constructor parameters

This commit is contained in:
Dmitry Jemerov
2016-05-25 13:31:36 +02:00
parent b51637d49f
commit e9cefd9ece
3 changed files with 7 additions and 4 deletions

View File

@@ -56,7 +56,10 @@ internal class VariablesHighlightingVisitor(holder: AnnotationHolder, bindingCon
}
override fun visitParameter(parameter: KtParameter) {
visitVariableDeclaration(parameter)
val propertyDescriptor = bindingContext.get(BindingContext.PRIMARY_CONSTRUCTOR_PARAMETER, parameter)
if (propertyDescriptor == null) {
visitVariableDeclaration(parameter)
}
super.visitParameter(parameter)
}

View File

@@ -1,4 +1,4 @@
class <info textAttributesKey="KOTLIN_CLASS">My</info>(val <info textAttributesKey="KOTLIN_PARAMETER"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">x</info></info>: <info textAttributesKey="KOTLIN_CLASS">Int</info>?)
class <info textAttributesKey="KOTLIN_CLASS">My</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">x</info>: <info textAttributesKey="KOTLIN_CLASS">Int</info>?)
fun <info textAttributesKey="KOTLIN_CLASS">My</info>?.<info textAttributesKey="KOTLIN_FUNCTION_DECLARATION">foo</info>(): <info textAttributesKey="KOTLIN_CLASS">Int</info> {
if (this == null) return 42

View File

@@ -10,7 +10,7 @@ val <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY">y</info> : <info textAttri
return 5.<info textAttributesKey="KOTLIN_EXTENSION_PROPERTY">sq</info> + <info textAttributesKey="KOTLIN_BACKING_FIELD_VARIABLE">field</info> + <info textAttributesKey="KOTLIN_PACKAGE_PROPERTY"><info textAttributesKey="KOTLIN_MUTABLE_VARIABLE">x</info></info>
}
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributesKey="KOTLIN_PARAMETER"><info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info></info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>, <info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>) {
class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributesKey="KOTLIN_INSTANCE_PROPERTY">a</info> : <info textAttributesKey="KOTLIN_CLASS">Int</info>, <info textAttributesKey="KOTLIN_PARAMETER">b</info> : <info textAttributesKey="KOTLIN_CLASS">String</info>) {
<info>init</info> {
<info textAttributesKey="KOTLIN_PARAMETER">b</info>
}
@@ -26,4 +26,4 @@ class <info textAttributesKey="KOTLIN_CLASS">Foo</info>(val <info textAttributes
}
}
// NO_CHECK_WARNINGS
// NO_CHECK_WARNINGS1