Test return type mismatch on override diagnostic rendering

This commit is contained in:
Pavel V. Talanov
2016-02-17 17:27:46 +03:00
parent 7ba4adf006
commit 5dcfdb3996
4 changed files with 31 additions and 0 deletions
@@ -0,0 +1,17 @@
// !DIAGNOSTICS_NUMBER: 2
// !DIAGNOSTICS: RETURN_TYPE_MISMATCH_ON_OVERRIDE
// !MESSAGE_TYPE: HTML
package myPackage.a.b
open class A {
open fun f(): kotlin.String = "asd"
open fun g(): kotlin.String = "Asd"
}
class B : A() {
override fun f(): String = String()
override fun g(): kotlin.Int = 3
}
class String
@@ -0,0 +1,4 @@
<!-- returnTypeMismatchOnOverride1 -->
<html>
Return type is 'myPackage.a.b.String', which is not a subtype of overridden<br/>
<b>public</b> <b>open</b> <b>fun</b> f(): kotlin.String <i>defined in</i> myPackage.a.b.A</html>
@@ -0,0 +1,4 @@
<!-- returnTypeMismatchOnOverride2 -->
<html>
Return type is 'Int', which is not a subtype of overridden<br/>
<b>public</b> <b>open</b> <b>fun</b> g(): String <i>defined in</i> myPackage.a.b.A</html>
@@ -185,6 +185,12 @@ public class DiagnosticMessageTestGenerated extends AbstractDiagnosticMessageTes
doTest(fileName);
}
@TestMetadata("returnTypeMismatchOnOverride.kt")
public void testReturnTypeMismatchOnOverride() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/returnTypeMismatchOnOverride.kt");
doTest(fileName);
}
@TestMetadata("typeInferenceCannotCaptureTypes.kt")
public void testTypeInferenceCannotCaptureTypes() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/diagnosticMessage/typeInferenceCannotCaptureTypes.kt");