diff --git a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties index 70cdecd48ed..5e3bfb6e7f0 100644 --- a/idea/src/org/jetbrains/jet/plugin/JetBundle.properties +++ b/idea/src/org/jetbrains/jet/plugin/JetBundle.properties @@ -149,6 +149,7 @@ options.kotlin.attribute.descriptor.kdoc.comment=KDoc comment options.kotlin.attribute.descriptor.kdoc.tag=KDoc tag options.kotlin.attribute.descriptor.kdoc.value=KDoc tag value options.kotlin.attribute.descriptor.trait=Trait +options.kotlin.attribute.descriptor.object=Object options.kotlin.attribute.descriptor.annotation=Annotation options.kotlin.attribute.descriptor.var=Var (mutable variable, parameter or property) options.kotlin.attribute.descriptor.local.variable=Local variable or value diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java index 35140f346da..d820d9f1232 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetColorSettingsPage.java @@ -134,6 +134,7 @@ public class JetColorSettingsPage implements ColorSettingsPage { new AttributesDescriptor(OptionsBundle.message("options.java.attribute.descriptor.abstract.class"), JetHighlightingColors.ABSTRACT_CLASS), new AttributesDescriptor(JetBundle.message("options.kotlin.attribute.descriptor.trait"), JetHighlightingColors.TRAIT), new AttributesDescriptor(JetBundle.message("options.kotlin.attribute.descriptor.annotation"), JetHighlightingColors.ANNOTATION), + new AttributesDescriptor(JetBundle.message("options.kotlin.attribute.descriptor.object"), JetHighlightingColors.OBJECT), new AttributesDescriptor(JetBundle.message("options.kotlin.attribute.descriptor.var"), JetHighlightingColors.MUTABLE_VARIABLE), diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java index 0af67cf10f0..dc3e3a122cd 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetHighlightingColors.java @@ -54,6 +54,7 @@ public class JetHighlightingColors { public static final TextAttributesKey ABSTRACT_CLASS = createTextAttributesKey("KOTLIN_ABSTRACT_CLASS", CodeInsightColors.ABSTRACT_CLASS_NAME_ATTRIBUTES); public static final TextAttributesKey TRAIT = createTextAttributesKey("KOTLIN_TRAIT", CodeInsightColors.INTERFACE_NAME_ATTRIBUTES); public static final TextAttributesKey ANNOTATION = createTextAttributesKey("KOTLIN_ANNOTATION", CodeInsightColors.ANNOTATION_NAME_ATTRIBUTES); + public static final TextAttributesKey OBJECT = createTextAttributesKey("KOTLIN_OBJECT", CLASS); // variable kinds public static final TextAttributesKey MUTABLE_VARIABLE = createTextAttributesKey("KOTLIN_MUTABLE_VARIABLE"); diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/TypeKindHighlightingVisitor.java b/idea/src/org/jetbrains/jet/plugin/highlighter/TypeKindHighlightingVisitor.java index 825cc057ff2..1e459b9409f 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/TypeKindHighlightingVisitor.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/TypeKindHighlightingVisitor.java @@ -93,8 +93,8 @@ class TypeKindHighlightingVisitor extends AfterAnalysisHighlightingVisitor { case ANNOTATION_CLASS: return JetHighlightingColors.ANNOTATION; case OBJECT: + return JetHighlightingColors.OBJECT; case ENUM_ENTRY: - // Treat object accesses as variables to simulate the old behaviour (when variables were created for objects) return JetHighlightingColors.INSTANCE_PROPERTY; default: return descriptor.getModality() == Modality.ABSTRACT diff --git a/idea/testData/highlighter/Object.kt b/idea/testData/highlighter/Object.kt index dde53708c51..1533b54340f 100644 --- a/idea/testData/highlighter/Object.kt +++ b/idea/testData/highlighter/Object.kt @@ -4,8 +4,9 @@ object O { fun foo() = 42 } -fun testing() { - O.foo() - val o = O +fun testing(): O { + O.foo() + val o = O o.foo() + return O } diff --git a/idea/testData/highlighter/VariablesAsFunctions.kt b/idea/testData/highlighter/VariablesAsFunctions.kt index 68468e40d80..3f55a7efd31 100644 --- a/idea/testData/highlighter/VariablesAsFunctions.kt +++ b/idea/testData/highlighter/VariablesAsFunctions.kt @@ -3,18 +3,18 @@ trait FunctionLike { } } -var global : () -> Unit = {} +var global : () -> Unit = {} -val Int.ext : () -> Unit +val Int.ext : () -> Unit get() { return {} } -fun foo(a : () -> Unit, functionLike: FunctionLike) { +fun foo(a : () -> Unit, functionLike: FunctionLike) { a() functionLike() global() 1.ext(); {}() //should not be highlighted as "calling variable as function"! -} \ No newline at end of file +}