Implicit receiver smart casts implementation and highlighting

This commit is contained in:
Mikhail Glukhikh
2015-11-09 15:18:37 +03:00
parent 03287d5d66
commit 811ba8110f
17 changed files with 175 additions and 8 deletions
@@ -74,6 +74,11 @@ class VariablesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
holder.createInfoAnnotation(expression, "Smart cast to " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(smartCast)).setTextAttributes(
KotlinHighlightingColors.SMART_CAST_VALUE);
}
smartCast = bindingContext.get(IMPLICIT_RECEIVER_SMARTCAST, expression);
if (smartCast != null) {
holder.createInfoAnnotation(expression, "Implicit receiver smart cast to " + DescriptorRenderer.FQ_NAMES_IN_TYPES.renderType(smartCast)).setTextAttributes(
KotlinHighlightingColors.SMART_CAST_VALUE);
}
super.visitExpression(expression);
}
+5 -1
View File
@@ -1,5 +1,9 @@
<info descr="null">open</info> class A() {
fun foo() {}
fun foo() {
if (this is B) {
<info descr="Implicit receiver smart cast to B">bar</info>()
}
}
}
class B() : A() {