Fix message text for INCOMPATIBLE_ENUM_COMPARISON
^KT-28516 Fixed
This commit is contained in:
+1
-1
@@ -731,7 +731,7 @@ public class DefaultErrorMessages {
|
|||||||
return nameExpression.getReferencedName();
|
return nameExpression.getReferencedName();
|
||||||
}, RENDER_TYPE, RENDER_TYPE);
|
}, RENDER_TYPE, RENDER_TYPE);
|
||||||
|
|
||||||
MAP.put(INCOMPATIBLE_ENUM_COMPARISON, "Comparison of incompatible enums ''{1}'' and ''{2}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
|
MAP.put(INCOMPATIBLE_ENUM_COMPARISON, "Comparison of incompatible enums ''{0}'' and ''{1}'' is always unsuccessful", RENDER_TYPE, RENDER_TYPE);
|
||||||
|
|
||||||
MAP.put(SENSELESS_COMPARISON, "Condition ''{0}'' is always ''{1}''", ELEMENT_TEXT, TO_STRING);
|
MAP.put(SENSELESS_COMPARISON, "Condition ''{0}'' is always ''{1}''", ELEMENT_TEXT, TO_STRING);
|
||||||
MAP.put(SENSELESS_NULL_IN_WHEN, "Expression under 'when' is never equal to null");
|
MAP.put(SENSELESS_NULL_IN_WHEN, "Expression under 'when' is never equal to null");
|
||||||
|
|||||||
+1
-1
@@ -685,7 +685,7 @@ class PatternMatchingTypingVisitor internal constructor(facade: ExpressionTyping
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (TypeIntersector.isIncompatibleEnums(type, subjectType)) {
|
if (TypeIntersector.isIncompatibleEnums(type, subjectType)) {
|
||||||
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(reportErrorOn, type, subjectType))
|
context.trace.report(INCOMPATIBLE_ENUM_COMPARISON.on(reportErrorOn, subjectType, type))
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if the pattern is essentially a 'null' expression
|
// check if the pattern is essentially a 'null' expression
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// !DIAGNOSTICS_NUMBER: 2
|
||||||
|
// !DIAGNOSTICS: INCOMPATIBLE_ENUM_COMPARISON
|
||||||
|
// !MESSAGE_TYPE: TEXT
|
||||||
|
|
||||||
|
enum class E1 {
|
||||||
|
A, B
|
||||||
|
}
|
||||||
|
|
||||||
|
enum class E2 {
|
||||||
|
A, B
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo1(e1: E1, e2: E2) {
|
||||||
|
e1 == e2
|
||||||
|
}
|
||||||
|
|
||||||
|
fun foo2(e1: E1, e2: E2) {
|
||||||
|
when (e1) {
|
||||||
|
E2.A -> {}
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<!-- incompatibleEnums1 -->
|
||||||
|
Comparison of incompatible enums 'E1' and 'E2' is always unsuccessful
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
<!-- incompatibleEnums2 -->
|
||||||
|
Comparison of incompatible enums 'E1' and 'E2' is always unsuccessful
|
||||||
+5
@@ -114,6 +114,11 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
|
|||||||
runTest("idea/testData/diagnosticMessage/illegalSuspendCall.kt");
|
runTest("idea/testData/diagnosticMessage/illegalSuspendCall.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("incompatibleEnums.kt")
|
||||||
|
public void testIncompatibleEnums() throws Exception {
|
||||||
|
runTest("idea/testData/diagnosticMessage/incompatibleEnums.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("invisibleMember.kt")
|
@TestMetadata("invisibleMember.kt")
|
||||||
public void testInvisibleMember() throws Exception {
|
public void testInvisibleMember() throws Exception {
|
||||||
runTest("idea/testData/diagnosticMessage/invisibleMember.kt");
|
runTest("idea/testData/diagnosticMessage/invisibleMember.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user