Add test for stub type receiver and for KT-53639

This commit is contained in:
Mikhail Glukhikh
2022-08-18 13:55:43 +02:00
committed by teamcity
parent 5cbecd276c
commit f6ad6fb816
9 changed files with 152 additions and 0 deletions
@@ -14343,6 +14343,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/inference/builderInference/equalityChecksOnIntegerTypesProgressive.kt");
}
@Test
@TestMetadata("errorOnStubReceiver.kt")
public void testErrorOnStubReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14439,6 +14445,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
}
@Test
@TestMetadata("kt53639.kt")
public void testKt53639() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53639.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -14343,6 +14343,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/builderInference/equalityChecksOnIntegerTypesProgressive.kt");
}
@Test
@TestMetadata("errorOnStubReceiver.kt")
public void testErrorOnStubReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14439,6 +14445,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
}
@Test
@TestMetadata("kt53639.kt")
public void testKt53639() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53639.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -14343,6 +14343,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/builderInference/equalityChecksOnIntegerTypesProgressive.kt");
}
@Test
@TestMetadata("errorOnStubReceiver.kt")
public void testErrorOnStubReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14439,6 +14445,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
}
@Test
@TestMetadata("kt53639.kt")
public void testKt53639() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53639.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {
@@ -0,0 +1,21 @@
// WITH_STDLIB
// FIR_DUMP
// SKIP_TXT
fun Any?.test() {}
class Bar {
fun test() {}
}
fun main() {
buildList {
add(Bar())
this.get(0).test() // resolved to Any?.test
}
buildList<Bar> {
add(Bar())
this.get(0).test() // resolved to Bar.test
}
}
@@ -0,0 +1,24 @@
FILE: errorOnStubReceiver.fir.kt
public final fun R|kotlin/Any?|.test(): R|kotlin/Unit| {
}
public final class Bar : R|kotlin/Any| {
public constructor(): R|Bar| {
super<R|kotlin/Any|>()
}
public final fun test(): R|kotlin/Unit| {
}
}
public final fun main(): R|kotlin/Unit| {
R|kotlin/collections/buildList|<R|Bar|>(<L> = buildList@fun R|kotlin/collections/MutableList<Bar>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|/Bar.Bar|())
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)).R|/test|()
}
)
R|kotlin/collections/buildList|<R|Bar|>(<L> = buildList@fun R|kotlin/collections/MutableList<Bar>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(R|/Bar.Bar|())
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Bar|>|(Int(0)).R|/Bar.test|()
}
)
}
@@ -0,0 +1,21 @@
// WITH_STDLIB
// FIR_DUMP
// SKIP_TXT
fun Any?.test() {}
class Bar {
fun test() {}
}
fun main() {
buildList {
add(Bar())
this.get(0).test() // resolved to Any?.test
}
buildList<Bar> {
add(Bar())
this.get(0).test() // resolved to Bar.test
}
}
@@ -0,0 +1,19 @@
// WITH_STDLIB
// SKIP_TXT
fun <From, To> InputWrapper<From>.doMapping(
foo: (From) -> List<To>,
bar: (List<To>) -> Boolean = { it.isNotEmpty() },
) = InputWrapper(value = foo(value))
data class InputWrapper<TItem>(val value: TItem)
data class Output(val source: InputWrapper<List<String>>)
fun main2(input: InputWrapper<Unit>): Output {
val output = input.doMapping(
foo = { buildList { add("this is List<String>") } },
bar = { it.isNotEmpty() },
)
return Output(source = output)
}
@@ -0,0 +1,19 @@
// WITH_STDLIB
// SKIP_TXT
fun <From, To> InputWrapper<From>.doMapping(
foo: (From) -> List<To>,
bar: (List<To>) -> Boolean = { it.isNotEmpty() },
) = InputWrapper(value = foo(value))
data class InputWrapper<TItem>(val value: TItem)
data class Output(val source: InputWrapper<List<String>>)
fun main2(input: InputWrapper<Unit>): Output {
val output = input.<!INFERRED_INTO_DECLARED_UPPER_BOUNDS!>doMapping<!>(
foo = { buildList { add("this is List<String>") } },
bar = { it.isNotEmpty() },
)
return Output(source = <!TYPE_MISMATCH!>output<!>)
}
@@ -14349,6 +14349,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/equalityChecksOnIntegerTypesProgressive.kt");
}
@Test
@TestMetadata("errorOnStubReceiver.kt")
public void testErrorOnStubReceiver() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/errorOnStubReceiver.kt");
}
@Test
@TestMetadata("kt47744.kt")
public void testKt47744() throws Exception {
@@ -14445,6 +14451,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53422.kt");
}
@Test
@TestMetadata("kt53639.kt")
public void testKt53639() throws Exception {
runTest("compiler/testData/diagnostics/tests/inference/builderInference/kt53639.kt");
}
@Test
@TestMetadata("labaledCall.kt")
public void testLabaledCall() throws Exception {