[FIR] Add new test argParamTypeMismatch.kt for ARGUMENT_TYPE_MISMATCH diagnostics

This commit is contained in:
Ivan Kochurkin
2021-03-30 15:31:10 +03:00
committed by TeamCityServer
parent a09b836334
commit 4ffab5fe5a
5 changed files with 47 additions and 0 deletions
@@ -496,6 +496,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt");
}
@TestMetadata("argParamTypeMismatch.kt")
public void testArgParamTypeMismatch() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argParamTypeMismatch.kt");
}
@TestMetadata("argumentsOfAnnotations.kt")
public void testArgumentsOfAnnotations() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt");
@@ -0,0 +1,17 @@
FILE: argParamTypeMismatch.kt
public final fun foo(first: R|kotlin/String|): R|kotlin/Unit| {
}
public final fun foo2(first: R|kotlin/String|, second: R|kotlin/Int|): R|kotlin/Unit| {
}
public final fun test(): R|kotlin/Unit| {
lval int: R|kotlin/Int| = Int(1)
<Inapplicable(INAPPLICABLE): /foo>#(R|<local>/int|)
<Inapplicable(INAPPLICABLE): /foo>#(Int(2))
<Inapplicable(INAPPLICABLE): /foo>#(R|kotlin/run|<R|kotlin/Int|>(<L> = run@fun <anonymous>(): R|kotlin/Int| <kind=EXACTLY_ONCE> {
^ Int(20)
}
))
R|/foo2|(String(asdf), Int(3))
<Inapplicable(INAPPLICABLE): /foo2>#(Int(4), String(asdf))
<Inapplicable(INAPPLICABLE): /foo2>#(Int(5), Int(6))
}
@@ -0,0 +1,13 @@
fun foo(first: String) {}
fun foo2(first: String, second: Int) {}
fun test() {
val int = 1
foo(<!ARGUMENT_TYPE_MISMATCH!>int<!>)
foo(<!ARGUMENT_TYPE_MISMATCH!>2<!>)
foo(<!ARGUMENT_TYPE_MISMATCH!>run { 20 }<!>)
foo2("asdf", 3)
foo2(<!ARGUMENT_TYPE_MISMATCH!>4<!>, <!ARGUMENT_TYPE_MISMATCH!>"asdf"<!>)
foo2(<!ARGUMENT_TYPE_MISMATCH!>5<!>, 6)
}
@@ -581,6 +581,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt");
}
@Test
@TestMetadata("argParamTypeMismatch.kt")
public void testArgParamTypeMismatch() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argParamTypeMismatch.kt");
}
@Test
@TestMetadata("argumentsOfAnnotations.kt")
public void testArgumentsOfAnnotations() throws Exception {
@@ -585,6 +585,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt");
}
@Test
@TestMetadata("argParamTypeMismatch.kt")
public void testArgParamTypeMismatch() throws Exception {
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argParamTypeMismatch.kt");
}
@Test
@TestMetadata("argumentsOfAnnotations.kt")
public void testArgumentsOfAnnotations() throws Exception {