[FIR-TEST] Split outdated dfa test to separate tests
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
fun Any.withInvoke(f: String.() -> Unit) {
|
||||
if (this is String) {
|
||||
<!INAPPLICABLE_CANDIDATE!>f<!>() // Should be OK
|
||||
}
|
||||
}
|
||||
|
||||
fun String.withInvoke(f: String.() -> Unit) {
|
||||
f()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
FILE: invoke.kt
|
||||
public final fun R|kotlin/Any|.withInvoke(f: R|kotlin/String.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(this@R|/withInvoke| is R|kotlin/String|) -> {
|
||||
<Inapplicable(INAPPLICABLE): [kotlin/Function1.invoke]>#()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun R|kotlin/String|.withInvoke(f: R|kotlin/String.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
R|<local>/f|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(this@R|/withInvoke|)
|
||||
}
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
fun takeString(s: String) {}
|
||||
|
||||
class Wrapper(val s: String?) {
|
||||
fun withThis() {
|
||||
if (s != null) {
|
||||
takeString(this.s) // Should be OK
|
||||
}
|
||||
if (this.s != null) {
|
||||
takeString(s) // Should be OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun takeString(s: String) {}
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
FILE: mixingImplicitAndExplicitReceivers.kt
|
||||
public final fun takeString(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
public final class Wrapper : R|kotlin/Any| {
|
||||
public constructor(s: R|kotlin/String?|): R|Wrapper| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val s: R|kotlin/String?| = R|<local>/s|
|
||||
public get(): R|kotlin/String?|
|
||||
|
||||
public final fun withThis(): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(this@R|/Wrapper|.R|/Wrapper.s|, Null(null)) -> {
|
||||
R|/takeString|(this@R|/Wrapper|.R|/Wrapper.s|)
|
||||
}
|
||||
}
|
||||
|
||||
when () {
|
||||
!=(this@R|/Wrapper|.R|/Wrapper.s|, Null(null)) -> {
|
||||
R|/takeString|(this@R|/Wrapper|.R|/Wrapper.s|)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun takeString(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
fun test_2(s: String?) {
|
||||
s?.let {
|
||||
takeString(it) // Should be OK
|
||||
takeString(s) // Should be OK
|
||||
}
|
||||
}
|
||||
|
||||
class Wrapper(val s: String?) {
|
||||
fun withThis() {
|
||||
if (s != null) {
|
||||
takeString(this.s) // Should be OK
|
||||
}
|
||||
if (this.s != null) {
|
||||
takeString(s) // Should be OK
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Any.withInvoke(f: String.() -> Unit) {
|
||||
if (this is String) {
|
||||
<!INAPPLICABLE_CANDIDATE!>f<!>() // Should be OK
|
||||
}
|
||||
}
|
||||
|
||||
fun String.withInvoke(f: String.() -> Unit) {
|
||||
f()
|
||||
}
|
||||
|
||||
fun takeString(s: String) {}
|
||||
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
FILE: complexSmartCasts.kt
|
||||
public final fun test_2(s: R|kotlin/String?|): R|kotlin/Unit| {
|
||||
R|<local>/s|?.R|kotlin/let|<R|kotlin/String|, R|kotlin/Unit|>(<L> = let@fun <anonymous>(it: R|kotlin/String|): R|kotlin/Unit| <kind=EXACTLY_ONCE> {
|
||||
R|/takeString|(R|<local>/it|)
|
||||
R|/takeString|(R|<local>/s|)
|
||||
}
|
||||
)
|
||||
}
|
||||
public final class Wrapper : R|kotlin/Any| {
|
||||
public constructor(s: R|kotlin/String?|): R|Wrapper| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val s: R|kotlin/String?| = R|<local>/s|
|
||||
public get(): R|kotlin/String?|
|
||||
|
||||
public final fun withThis(): R|kotlin/Unit| {
|
||||
when () {
|
||||
!=(this@R|/Wrapper|.R|/Wrapper.s|, Null(null)) -> {
|
||||
R|/takeString|(this@R|/Wrapper|.R|/Wrapper.s|)
|
||||
}
|
||||
}
|
||||
|
||||
when () {
|
||||
!=(this@R|/Wrapper|.R|/Wrapper.s|, Null(null)) -> {
|
||||
R|/takeString|(this@R|/Wrapper|.R|/Wrapper.s|)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun R|kotlin/Any|.withInvoke(f: R|kotlin/String.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
when () {
|
||||
(this@R|/withInvoke| is R|kotlin/String|) -> {
|
||||
<Inapplicable(INAPPLICABLE): [kotlin/Function1.invoke]>#()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public final fun R|kotlin/String|.withInvoke(f: R|kotlin/String.() -> kotlin/Unit|): R|kotlin/Unit| {
|
||||
R|<local>/f|.R|FakeOverride<kotlin/Function1.invoke: R|kotlin/Unit|>|(this@R|/withInvoke|)
|
||||
}
|
||||
public final fun takeString(s: R|kotlin/String|): R|kotlin/Unit| {
|
||||
}
|
||||
+23
@@ -1581,6 +1581,24 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/problems")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Problems extends AbstractFirDiagnosticsTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInProblems() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/problems/invoke.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/receivers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1603,6 +1621,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixingImplicitAndExplicitReceivers.kt")
|
||||
public void testMixingImplicitAndExplicitReceivers() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/mixingImplicitAndExplicitReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("thisOfExtensionProperty.kt")
|
||||
public void testThisOfExtensionProperty() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.kt");
|
||||
|
||||
Generated
+23
@@ -1581,6 +1581,24 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/problems")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class Problems extends AbstractFirDiagnosticsWithLightTreeTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInProblems() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/resolve/testData/resolve/smartcasts/problems"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("invoke.kt")
|
||||
public void testInvoke() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/problems/invoke.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/fir/resolve/testData/resolve/smartcasts/receivers")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
@@ -1603,6 +1621,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/implicitReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixingImplicitAndExplicitReceivers.kt")
|
||||
public void testMixingImplicitAndExplicitReceivers() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/mixingImplicitAndExplicitReceivers.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("thisOfExtensionProperty.kt")
|
||||
public void testThisOfExtensionProperty() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolve/smartcasts/receivers/thisOfExtensionProperty.kt");
|
||||
|
||||
Generated
-5
@@ -665,11 +665,6 @@ public class FirDiagnosticsWithStdlibTestGenerated extends AbstractFirDiagnostic
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/cloneArray.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("complexSmartCasts.kt")
|
||||
public void testComplexSmartCasts() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/complexSmartCasts.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("delegateTypeMismatch.kt")
|
||||
public void testDelegateTypeMismatch() throws Exception {
|
||||
runTest("compiler/fir/resolve/testData/resolveWithStdlib/problems/delegateTypeMismatch.kt");
|
||||
|
||||
Reference in New Issue
Block a user