diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java index 998298b74ef..fb1cf78bcd1 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/Errors.java @@ -189,7 +189,7 @@ public interface Errors { DiagnosticFactory2 NAME_IN_CONSTRAINT_IS_NOT_A_TYPE_PARAMETER = DiagnosticFactory2.create(ERROR); - SimpleDiagnosticFactory VARIANCE_ON_FUNCTION_OR_PROPERTY_PARAMETER = SimpleDiagnosticFactory.create(ERROR, VARIANCE_MODIFIER); + SimpleDiagnosticFactory VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY = SimpleDiagnosticFactory.create(ERROR, VARIANCE_MODIFIER); // Members diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java index ba2893893b6..e15efb95187 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/diagnostics/rendering/DefaultErrorMessages.java @@ -319,7 +319,7 @@ public class DefaultErrorMessages { MAP.put(AUTOCAST_IMPOSSIBLE, "Automatic cast to ''{0}'' is impossible, because ''{1}'' could have changed since the is-check", RENDER_TYPE, NAME); - MAP.put(VARIANCE_ON_FUNCTION_OR_PROPERTY_PARAMETER, "Variance annotations are only allowed for type parameters of classes and traits"); + MAP.put(VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY, "Variance annotations are only allowed for type parameters of classes and traits"); MAP.put(REDUNDANT_PROJECTION, "Projection is redundant: the corresponding type parameter of {0} has the same variance", NAME); MAP.put(CONFLICTING_PROJECTION, "Projection is conflicting with variance of the corresponding type parameter of {0}. Remove the projection or replace it with ''*''", NAME); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java index 4ef1726e66d..4a8e459e27b 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/DescriptorResolver.java @@ -524,7 +524,7 @@ public class DescriptorResolver { ) { if (typeParameter.getVariance() != Variance.INVARIANT) { assert !(containingDescriptor instanceof ClassifierDescriptor) : "This method is intended for functions/properties"; - trace.report(VARIANCE_ON_FUNCTION_OR_PROPERTY_PARAMETER.on(typeParameter)); + trace.report(VARIANCE_ON_TYPE_PARAMETER_OF_FUNCTION_OR_PROPERTY.on(typeParameter)); } // TODO: Annotations are not resolved! diff --git a/compiler/testData/diagnostics/tests/declarationChecks/VarianceOnFunctionAndPropertyTypeParameters.kt b/compiler/testData/diagnostics/tests/declarationChecks/VarianceOnFunctionAndPropertyTypeParameters.kt index 21f16fa375d..dd67d21293d 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/VarianceOnFunctionAndPropertyTypeParameters.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/VarianceOnFunctionAndPropertyTypeParameters.kt @@ -1,17 +1,17 @@ -fun <in T> f() { +fun <in T> f() { } -fun <out T> g() { +fun <out T> g() { } -fun <out T, in X, Y> h() { +fun <out T, in X, Y> h() { } -val <out T> T.x: Int +val <out T> T.x: Int get() = 1 -val <in T> T.y: Int +val <in T> T.y: Int get() = 1 \ No newline at end of file