KT-7689 Wrong error message format for type of ... doesn't match to the type of overridden var-property

#KT-7689 Fixed
This commit is contained in:
Andrey Breslav
2015-05-18 13:37:06 +03:00
parent fdf0ea5546
commit df6c20efa4
3 changed files with 20 additions and 2 deletions
@@ -487,10 +487,10 @@ public class DefaultErrorMessages {
MAP.put(CANNOT_WEAKEN_ACCESS_PRIVILEGE, "Cannot weaken access privilege ''{0}'' for ''{1}'' in ''{2}''", TO_STRING, NAME, NAME);
MAP.put(CANNOT_CHANGE_ACCESS_PRIVILEGE, "Cannot change access privilege ''{0}'' for ''{1}'' in ''{2}''", TO_STRING, NAME, NAME);
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "Return type of ''{0}'' is not a subtype of the return type of overridden member {1}",
MAP.put(RETURN_TYPE_MISMATCH_ON_OVERRIDE, "Return type of ''{0}'' is not a subtype of the return type of the overridden member ''{1}''",
NAME, FQ_NAMES_IN_TYPES);
MAP.put(PROPERTY_TYPE_MISMATCH_ON_OVERRIDE, "Type of ''{0}'' doesn't match to the type of overridden var-property {1}",
MAP.put(PROPERTY_TYPE_MISMATCH_ON_OVERRIDE, "Type of ''{0}'' doesn''t match the type of the overridden var-property ''{1}''",
NAME, FQ_NAMES_IN_TYPES);
MAP.put(VAR_OVERRIDDEN_BY_VAL, "Var-property {0} cannot be overridden by val-property {1}", FQ_NAMES_IN_TYPES, FQ_NAMES_IN_TYPES);
@@ -0,0 +1,12 @@
interface Base {
fun foo(): Int
var bar: Int
}
class Derived : Base {
override fun foo(): <error descr="[RETURN_TYPE_MISMATCH_ON_OVERRIDE] Return type of 'foo' is not a subtype of the return type of the overridden member 'internal abstract fun foo(): kotlin.Int defined in Base'">String</error> = ""
override var bar: <error descr="[PROPERTY_TYPE_MISMATCH_ON_OVERRIDE] Type of 'bar' doesn't match the type of the overridden var-property 'internal abstract var bar: kotlin.Int defined in Base'">String</error> = ""
}
@@ -283,6 +283,12 @@ public class JetPsiCheckerTestGenerated extends AbstractJetPsiCheckerTest {
doTest(fileName);
}
@TestMetadata("ReturnTypeMismatchOnOverride.kt")
public void testReturnTypeMismatchOnOverride() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/ReturnTypeMismatchOnOverride.kt");
doTest(fileName);
}
@TestMetadata("Shadowing.kt")
public void testShadowing() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/checker/Shadowing.kt");