Add addtional tests for builder inference
This commit is contained in:
+54
-24
@@ -12765,6 +12765,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScope.kt")
|
||||
public void testMemberScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullability.kt")
|
||||
public void testNullability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("renderingStubTypes.kt")
|
||||
public void testRenderingStubTypes() throws Exception {
|
||||
@@ -32322,6 +32334,48 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
public void testCompleteIrrelevantCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/completeIrrelevantCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCallsWithRestrictions.kt")
|
||||
public void testIncorrectCallsWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInferenceWithRestrictions.kt")
|
||||
public void testResolveUsualCallWithBuilderInferenceWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtensionWithRestrictions.kt")
|
||||
public void testUseInferenceInformationFromExtensionWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -33512,18 +33566,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraints_1_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferenceFromMethodInsideLocalVariable.kt")
|
||||
public void testInferenceFromMethodInsideLocalVariable() throws Exception {
|
||||
@@ -33668,12 +33710,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returnTypeInference.kt")
|
||||
public void testReturnTypeInference() throws Exception {
|
||||
@@ -33722,12 +33758,6 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableCallInsideBuilderFunction.kt")
|
||||
public void testVariableCallInsideBuilderFunction() throws Exception {
|
||||
|
||||
+54
-24
@@ -12765,6 +12765,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScope.kt")
|
||||
public void testMemberScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullability.kt")
|
||||
public void testNullability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("renderingStubTypes.kt")
|
||||
public void testRenderingStubTypes() throws Exception {
|
||||
@@ -32322,6 +32334,48 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
public void testCompleteIrrelevantCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/completeIrrelevantCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCallsWithRestrictions.kt")
|
||||
public void testIncorrectCallsWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInferenceWithRestrictions.kt")
|
||||
public void testResolveUsualCallWithBuilderInferenceWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtensionWithRestrictions.kt")
|
||||
public void testUseInferenceInformationFromExtensionWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -33512,18 +33566,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraints_1_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferenceFromMethodInsideLocalVariable.kt")
|
||||
public void testInferenceFromMethodInsideLocalVariable() throws Exception {
|
||||
@@ -33668,12 +33710,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returnTypeInference.kt")
|
||||
public void testReturnTypeInference() throws Exception {
|
||||
@@ -33722,12 +33758,6 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableCallInsideBuilderFunction.kt")
|
||||
public void testVariableCallInsideBuilderFunction() throws Exception {
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface A {
|
||||
fun foo(): MutableList<String>
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun main() {
|
||||
buildList {
|
||||
add(3)
|
||||
object : A {
|
||||
override fun foo(): MutableList<String> = this@buildList
|
||||
}
|
||||
}
|
||||
buildList {
|
||||
add(3)
|
||||
val x: String = get(0)
|
||||
}
|
||||
buildList {
|
||||
add("3")
|
||||
val x: MutableList<Int> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
val y: CharSequence = ""
|
||||
add(y)
|
||||
val x: MutableList<String> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add("")
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
}
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// WITH_RUNTIME
|
||||
|
||||
interface A {
|
||||
fun foo(): MutableList<String>
|
||||
}
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun main() {
|
||||
buildList {
|
||||
add(<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>3<!>)
|
||||
object : A {
|
||||
override fun foo(): MutableList<String> = this@buildList
|
||||
}
|
||||
}
|
||||
buildList {
|
||||
add(<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>3<!>)
|
||||
val x: String = get(0)
|
||||
}
|
||||
buildList {
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH!>"3"<!>)
|
||||
val x: MutableList<Int> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
val y: CharSequence = ""
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>y<!>)
|
||||
val x: MutableList<String> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH!>""<!>)
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
}
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package
|
||||
|
||||
@kotlin.ExperimentalStdlibApi public fun main(): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.collections.MutableList<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
Vendored
+57
-27
@@ -1,39 +1,69 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR -CAST_NEVER_SUCCEEDS
|
||||
|
||||
interface A {
|
||||
fun foo(): MutableList<String>
|
||||
}
|
||||
fun <K> id(x: K): K = x
|
||||
|
||||
fun <K, V> build(@BuilderInference builderAction: MutableMap<K, V>.() -> V) {}
|
||||
|
||||
fun <K, V> build2(@BuilderInference builderAction: MutableMap<K, V>.() -> K) {}
|
||||
|
||||
fun <K, V> build3(@BuilderInference builderAction: MutableMap<K, V>.(K) -> Unit) {}
|
||||
|
||||
fun <K, V> build4(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<String, Int>) {}
|
||||
|
||||
fun <K : V, V : CharSequence> build5(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<String, V>) {}
|
||||
|
||||
fun <K : V, V : CharSequence> build6(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<K, String>) {}
|
||||
|
||||
fun <K : V, V : CharSequence> build7(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<String, V>) = null as MutableMap<String, V>
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun main() {
|
||||
buildList {
|
||||
add(3)
|
||||
object : A {
|
||||
override fun foo(): MutableList<String> = this@buildList
|
||||
}
|
||||
}
|
||||
buildList {
|
||||
add(3)
|
||||
val x: String = get(0)
|
||||
}
|
||||
buildList {
|
||||
add("3")
|
||||
val x: MutableList<Int> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
val y: CharSequence = ""
|
||||
add(y)
|
||||
val x: MutableList<String> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add("")
|
||||
val x: MutableList<CharSequence> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add("")
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
buildMap {
|
||||
val x: Function2<String, Char, Char?> = ::put
|
||||
}
|
||||
}
|
||||
|
||||
build {
|
||||
get("")
|
||||
""
|
||||
}
|
||||
|
||||
build2 {
|
||||
val x: String = this.values.first()
|
||||
1
|
||||
}
|
||||
|
||||
build2 {
|
||||
take(this.values.first())
|
||||
1
|
||||
}
|
||||
|
||||
build3 { key: String ->
|
||||
take(this.values.first())
|
||||
}
|
||||
|
||||
build3 { this.foo() }
|
||||
|
||||
build4 { this }
|
||||
|
||||
build4 { this.run { this } }
|
||||
|
||||
build4 { run { this } }
|
||||
build4 { id(run { this }) }
|
||||
|
||||
build5 { id(run { this }) }
|
||||
build6 { id(run { this }) }
|
||||
|
||||
val x: MutableMap<String, CharSequence> = build7 {
|
||||
id(run { this })
|
||||
}
|
||||
}
|
||||
|
||||
fun MutableMap<String, Int>.foo() {}
|
||||
|
||||
fun take(x: String) {}
|
||||
Vendored
+3
-29
@@ -1,9 +1,6 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR
|
||||
|
||||
interface A {
|
||||
fun foo(): MutableList<String>
|
||||
}
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR -CAST_NEVER_SUCCEEDS
|
||||
|
||||
fun <K> id(x: K): K = x
|
||||
|
||||
@@ -19,37 +16,14 @@ fun <K : V, V : CharSequence> build5(@BuilderInference builderAction: MutableMap
|
||||
|
||||
fun <K : V, V : CharSequence> build6(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<K, String>) {}
|
||||
|
||||
fun <K : V, V : CharSequence> build7(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<String, V>): MutableMap<String, V> {}
|
||||
fun <K : V, V : CharSequence> build7(@BuilderInference builderAction: MutableMap<K, V>.() -> MutableMap<String, V>) = null as MutableMap<String, V>
|
||||
|
||||
@ExperimentalStdlibApi
|
||||
fun main() {
|
||||
buildList {
|
||||
add(<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>3<!>)
|
||||
object : A {
|
||||
override fun foo(): MutableList<String> = this@buildList
|
||||
}
|
||||
}
|
||||
buildList {
|
||||
add(<!CONSTANT_EXPECTED_TYPE_MISMATCH, CONSTANT_EXPECTED_TYPE_MISMATCH!>3<!>)
|
||||
val x: String = get(0)
|
||||
}
|
||||
buildList {
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH!>"3"<!>)
|
||||
val x: MutableList<Int> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
val y: CharSequence = ""
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>y<!>)
|
||||
val x: MutableList<String> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add("")
|
||||
val x: MutableList<CharSequence> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH!>""<!>)
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
buildMap {
|
||||
val x: Function2<String, Char, Char?> = ::put
|
||||
}
|
||||
|
||||
Vendored
+1
-6
@@ -6,14 +6,9 @@ public fun </*0*/ K, /*1*/ V> build3(/*0*/ @kotlin.BuilderInference builderActio
|
||||
public fun </*0*/ K, /*1*/ V> build4(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> kotlin.collections.MutableMap<kotlin.String, kotlin.Int>): kotlin.Unit
|
||||
public fun </*0*/ K : V, /*1*/ V : kotlin.CharSequence> build5(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> kotlin.collections.MutableMap<kotlin.String, V>): kotlin.Unit
|
||||
public fun </*0*/ K : V, /*1*/ V : kotlin.CharSequence> build6(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> kotlin.collections.MutableMap<K, kotlin.String>): kotlin.Unit
|
||||
public fun </*0*/ K : V, /*1*/ V : kotlin.CharSequence> build7(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> kotlin.collections.MutableMap<kotlin.String, V>): kotlin.collections.MutableMap<kotlin.String, V>
|
||||
public fun </*0*/ K> id(/*0*/ x: K): K
|
||||
@kotlin.ExperimentalStdlibApi public fun main(): kotlin.Unit
|
||||
public fun take(/*0*/ x: kotlin.String): kotlin.Unit
|
||||
public fun kotlin.collections.MutableMap<kotlin.String, kotlin.Int>.foo(): kotlin.Unit
|
||||
|
||||
public interface A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun foo(): kotlin.collections.MutableList<kotlin.String>
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
+20
-20
@@ -30,7 +30,7 @@ fun foo7() = null as Foo7<Int>
|
||||
|
||||
interface FlowCollector<in T> {}
|
||||
|
||||
fun <L> flow(@BuilderInference block: suspend FlowCollector<L>.() -> Unit) = Flow(block)
|
||||
fun <L> flow(@BuilderInference block: suspend FlowCollector<L>.() -> Unit): Flow<L> = Flow(block)
|
||||
|
||||
class Flow<out R>(private val block: suspend FlowCollector<R>.() -> Unit)
|
||||
|
||||
@@ -39,7 +39,7 @@ fun <R> select(vararg x: R) = x[0]
|
||||
fun poll0(): Flow<String> {
|
||||
return flow {
|
||||
val inv = <!NEW_INFERENCE_ERROR!>select(::bar, ::foo)<!>
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ fun poll14(flag: Boolean): Flow<String> {
|
||||
fun poll15(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = if (flag) { ::bar5 } else { ::foo5 }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ fun poll17(flag: Boolean): Flow<String> {
|
||||
fun poll2(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> ::bar else -> ::foo }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ fun poll26(flag: Boolean): Flow<String> {
|
||||
fun poll3(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> ::bar false -> ::foo }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ fun poll36(flag: Boolean): Flow<String> {
|
||||
fun poll4(): Flow<String> {
|
||||
return flow {
|
||||
val inv = try { ::bar } finally { ::foo }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ fun poll43(): Flow<String> {
|
||||
fun poll44(): Flow<String> {
|
||||
return flow {
|
||||
val inv = try { ::bar5 } finally { ::foo5 }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ fun poll46(): Flow<String> {
|
||||
fun poll5(): Flow<String> {
|
||||
return flow {
|
||||
val inv = try { ::bar } catch (e: Exception) { ::foo } finally { ::foo }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ fun poll53(): Flow<String> {
|
||||
fun poll54(): Flow<String> {
|
||||
return flow {
|
||||
val inv = try { ::bar5 } catch (e: Exception) { ::foo5 } finally { ::foo5 }
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,49 +388,49 @@ fun poll66(): Flow<String> {
|
||||
|
||||
fun poll7(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
inv(<!NO_VALUE_FOR_PARAMETER!>)<!>
|
||||
val inv = ::bar!!
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
fun poll71(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar2<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::bar2!!
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
fun poll72(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar3<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::bar3!!
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
fun poll73(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar4<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::bar4!!
|
||||
inv
|
||||
}
|
||||
}
|
||||
|
||||
fun poll74(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar5<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::bar5!!
|
||||
inv
|
||||
}
|
||||
}
|
||||
|
||||
fun poll75(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::Foo6<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::Foo6!!
|
||||
inv
|
||||
}
|
||||
}
|
||||
|
||||
fun poll76(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::Foo7<!NOT_NULL_ASSERTION_ON_CALLABLE_REFERENCE!>!!<!>
|
||||
val inv = ::Foo7!!
|
||||
inv
|
||||
}
|
||||
}
|
||||
@@ -438,21 +438,21 @@ fun poll76(): Flow<String> {
|
||||
fun poll8(): Flow<String> {
|
||||
return flow {
|
||||
val inv = <!NEW_INFERENCE_ERROR!>::bar in <!NEW_INFERENCE_ERROR!>setOf(::foo)<!><!>
|
||||
<!UNRESOLVED_REFERENCE!>inv<!>()
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
fun poll81(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar2 in setOf(::foo2)
|
||||
<!UNRESOLVED_REFERENCE!>inv<!>()
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
fun poll82(): Flow<String> {
|
||||
return flow {
|
||||
val inv = ::bar3 in <!NEW_INFERENCE_ERROR!>setOf(::foo3)<!>
|
||||
<!UNRESOLVED_REFERENCE!>inv<!>()
|
||||
inv()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/builderInference/specialCallsWithCallableReferences.kt
Vendored
+10
-10
@@ -30,7 +30,7 @@ fun foo7() = null as Foo7<Int>
|
||||
|
||||
interface FlowCollector<in T> {}
|
||||
|
||||
fun <L> flow(@BuilderInference block: suspend FlowCollector<L>.() -> Unit) = Flow(block)
|
||||
fun <L> flow(@BuilderInference block: suspend FlowCollector<L>.() -> Unit): Flow<L> = Flow(block)
|
||||
|
||||
class Flow<out R>(private val block: suspend FlowCollector<R>.() -> Unit)
|
||||
|
||||
@@ -38,7 +38,7 @@ fun <R> select(vararg x: R) = x[0]
|
||||
|
||||
fun poll0(): Flow<String> {
|
||||
return flow {
|
||||
val inv = select(<!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!>, <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!>)
|
||||
val inv = select(::bar, ::foo)
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ fun poll01(): Flow<String> {
|
||||
|
||||
fun poll02(): Flow<String> {
|
||||
return flow {
|
||||
val inv = select(<!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar3<!><!>, <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo3<!><!>)
|
||||
val inv = select(::bar3, ::foo3)
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ fun poll03(): Flow<String> {
|
||||
|
||||
fun poll04(): Flow<String> {
|
||||
return flow {
|
||||
val inv = select(<!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar5<!><!>, <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo5<!><!>)
|
||||
val inv = select(::bar5, ::foo5)
|
||||
inv
|
||||
}
|
||||
}
|
||||
@@ -143,7 +143,7 @@ fun poll17(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll2(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!> else -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!> }
|
||||
val inv = when (flag) { true -> ::bar else -> ::foo }
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ fun poll21(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll22(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar3<!><!> else -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo3<!><!> }
|
||||
val inv = when (flag) { true -> ::bar3 else -> ::foo3 }
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -171,7 +171,7 @@ fun poll23(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll24(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar5<!><!> else -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo5<!><!> }
|
||||
val inv = when (flag) { true -> ::bar5 else -> ::foo5 }
|
||||
inv
|
||||
}
|
||||
}
|
||||
@@ -192,7 +192,7 @@ fun poll26(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll3(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar<!><!> false -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo<!><!> }
|
||||
val inv = when (flag) { true -> ::bar false -> ::foo }
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -206,7 +206,7 @@ fun poll31(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll32(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar3<!><!> false -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo3<!><!> }
|
||||
val inv = when (flag) { true -> ::bar3 false -> ::foo3 }
|
||||
inv()
|
||||
}
|
||||
}
|
||||
@@ -220,7 +220,7 @@ fun poll33(flag: Boolean): Flow<String> {
|
||||
|
||||
fun poll34(flag: Boolean): Flow<String> {
|
||||
return flow {
|
||||
val inv = when (flag) { true -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>bar5<!><!> false -> <!TYPE_INFERENCE_POSTPONED_VARIABLE_IN_RECEIVER_TYPE!>::<!DEBUG_INFO_MISSING_UNRESOLVED!>foo5<!><!> }
|
||||
val inv = when (flag) { true -> ::bar5 false -> ::foo5 }
|
||||
inv
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -UNCHECKED_CAST -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -UNCHECKED_CAST -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -UNCHECKED_CAST -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// !LANGUAGE: +UnrestrictedBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -UNCHECKED_CAST -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeCovariant.kt
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/commonSuperTypeInvariant.kt
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNCHECKED_CAST -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface TestInterface<R> {
|
||||
fun emit(r: R)
|
||||
fun get(): R
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1> build(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
fun Any.test() {}
|
||||
fun Any?.test2() {}
|
||||
|
||||
fun test() {
|
||||
val ret = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
get()?.test()
|
||||
get()?.test2()
|
||||
get().test2()
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
// there is `String?.equals` extension
|
||||
get().equals("")
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
|
||||
if (get() == null) {}
|
||||
if (get() === null) {}
|
||||
|
||||
if (x != null) {
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
if (x === null) {
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x?.test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
""
|
||||
}
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface TestInterface<R> {
|
||||
fun emit(r: R)
|
||||
fun get(): R
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1> build(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
fun Any.test() {}
|
||||
fun Any?.test2() {}
|
||||
|
||||
fun test() {
|
||||
val ret = build {
|
||||
emit(1)
|
||||
emit(null)
|
||||
get()?.test()
|
||||
get()?.test2()
|
||||
get().test2()
|
||||
get()?.hashCode()
|
||||
get()?.equals(1)
|
||||
// there is `String?.equals` extension
|
||||
<!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>get()<!>.equals("")
|
||||
val x = get()
|
||||
x?.hashCode()
|
||||
x?.equals(1)
|
||||
x.equals("")
|
||||
|
||||
if (get() == null) {}
|
||||
if (get() === null) {}
|
||||
|
||||
if (x != null) {
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>hashCode()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
if (x == null) {
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.hashCode()
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
if (x === null) {
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.hashCode()
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.equals(1)
|
||||
x.equals("")
|
||||
x.hashCode()
|
||||
x.toString()
|
||||
x.test()
|
||||
<!DEBUG_INFO_CONSTANT!>x<!>?.test2()
|
||||
x.test2()
|
||||
}
|
||||
|
||||
""
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package
|
||||
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R1> build(/*0*/ @kotlin.BuilderInference block: TestInterface<R1>.() -> kotlin.Unit): R1
|
||||
public fun test(): kotlin.Unit
|
||||
public fun kotlin.Any.test(): kotlin.Unit
|
||||
public fun kotlin.Any?.test2(): kotlin.Unit
|
||||
|
||||
public interface TestInterface</*0*/ R> {
|
||||
public abstract fun emit(/*0*/ r: R): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun get(): R
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+62
@@ -0,0 +1,62 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface TestInterface<R> {
|
||||
fun emit(r: R)
|
||||
fun get(): R
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1> build(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : Any> build2(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : R2, R2 : Any> build3(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : R2, R2> build4(x: R2, @BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
fun test(a: String?) {
|
||||
val ret1 = build {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
val ret2 = build2 {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
val ret3 = build3 {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
val ret4 = build4(1) {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED
|
||||
// WITH_RUNTIME
|
||||
|
||||
// FILE: main.kt
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
interface TestInterface<R> {
|
||||
fun emit(r: R)
|
||||
fun get(): R
|
||||
}
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1> build(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : Any> build2(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : R2, R2 : Any> build3(@BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
@UseExperimental(ExperimentalTypeInference::class)
|
||||
fun <R1 : R2, R2> build4(x: R2, @BuilderInference block: TestInterface<R1>.() -> Unit): R1 = TODO()
|
||||
|
||||
fun test(a: String?) {
|
||||
val ret1 = build {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
val ret2 = build2 {
|
||||
emit(1)
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
val x = get()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
x <!USELESS_ELVIS!>?: 1<!>
|
||||
x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
""
|
||||
}
|
||||
val ret3 = build3 {
|
||||
emit(1)
|
||||
get()<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
val x = get()
|
||||
x<!UNNECESSARY_SAFE_CALL!>?.<!>equals("")
|
||||
x <!USELESS_ELVIS!>?: 1<!>
|
||||
x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>
|
||||
""
|
||||
}
|
||||
val ret4 = build4(1) {
|
||||
emit(1)
|
||||
get()?.equals("")
|
||||
val x = get()
|
||||
x?.equals("")
|
||||
x ?: 1
|
||||
x!!
|
||||
""
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package
|
||||
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R1> build(/*0*/ @kotlin.BuilderInference block: TestInterface<R1>.() -> kotlin.Unit): R1
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R1 : kotlin.Any> build2(/*0*/ @kotlin.BuilderInference block: TestInterface<R1>.() -> kotlin.Unit): R1
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R1 : R2, /*1*/ R2 : kotlin.Any> build3(/*0*/ @kotlin.BuilderInference block: TestInterface<R1>.() -> kotlin.Unit): R1
|
||||
@kotlin.UseExperimental(markerClass = {kotlin.experimental.ExperimentalTypeInference::class}) public fun </*0*/ R1 : R2, /*1*/ R2> build4(/*0*/ x: R2, /*1*/ @kotlin.BuilderInference block: TestInterface<R1>.() -> kotlin.Unit): R1
|
||||
public fun test(/*0*/ a: kotlin.String?): kotlin.Unit
|
||||
|
||||
public interface TestInterface</*0*/ R> {
|
||||
public abstract fun emit(/*0*/ r: R): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public abstract fun get(): R
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
Vendored
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER -DEPRECATION -EXPERIMENTAL_IS_NOT_ENABLED -UNUSED_VARIABLE
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
fun notYield(t: T) {}
|
||||
|
||||
suspend fun yieldBarReturnType(t: T) = t
|
||||
fun barReturnType(): T = TODO()
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
yield(3)
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
yield(3)
|
||||
notYield(3)
|
||||
}
|
||||
|
||||
val test3 = generate {
|
||||
yield(3)
|
||||
yieldBarReturnType(3)
|
||||
}
|
||||
|
||||
val test4 = generate {
|
||||
yield(3)
|
||||
barReturnType()
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// !USE_EXPERIMENTAL: kotlin.RequiresOptIn
|
||||
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
@file:OptIn(ExperimentalTypeInference::class)
|
||||
|
||||
import kotlin.experimental.ExperimentalTypeInference
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
fun notYield(t: T) {}
|
||||
|
||||
suspend fun yieldBarReturnType(t: T) = t
|
||||
fun barReturnType(): T = TODO()
|
||||
}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val test1 = generate {
|
||||
yield(3)
|
||||
}
|
||||
|
||||
val test2 = generate {
|
||||
yield(3)
|
||||
notYield(3)
|
||||
}
|
||||
|
||||
val test3 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
||||
yield(3)
|
||||
yieldBarReturnType(3)
|
||||
}
|
||||
|
||||
val test4 = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
||||
yield(3)
|
||||
barReturnType()
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
package
|
||||
|
||||
public val test1: kotlin.collections.List<kotlin.Int>
|
||||
public val test2: kotlin.collections.List<kotlin.Int>
|
||||
public val test3: [ERROR : Type for generate {
|
||||
yield(3)
|
||||
yieldBarReturnType(3)
|
||||
}]
|
||||
public val test4: [ERROR : Type for generate {
|
||||
yield(3)
|
||||
barReturnType()
|
||||
}]
|
||||
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
|
||||
public final class GenericController</*0*/ T> {
|
||||
public constructor GenericController</*0*/ T>()
|
||||
public final fun barReturnType(): T
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final fun notYield(/*0*/ t: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
|
||||
public final suspend fun yieldBarReturnType(/*0*/ t: T): T
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Builder<T> {
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
// !LANGUAGE: -ExperimentalBuilderInference
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Builder<T> {
|
||||
@@ -12,7 +12,7 @@ fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
suspend fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
val member = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
add(42)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,6 @@ val extension = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
val safeExtension = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>build<!> {
|
||||
safeExtensionAdd("foo")
|
||||
}
|
||||
+9
-3
@@ -1,11 +1,17 @@
|
||||
package
|
||||
|
||||
public val extension: kotlin.collections.List<kotlin.String>
|
||||
public val member: kotlin.collections.List<kotlin.Int>
|
||||
public val extension: [ERROR : Type for build {
|
||||
extensionAdd("foo")
|
||||
}]
|
||||
public val member: [ERROR : Type for build {
|
||||
add(42)
|
||||
}]
|
||||
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
|
||||
add(42)
|
||||
}]
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public val safeExtension: [ERROR : Type for build {
|
||||
safeExtensionAdd("foo")
|
||||
}]
|
||||
public fun </*0*/ S> build(/*0*/ g: suspend Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: annotation.kt
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// FILE: annotation.kt
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class Builder<T> {
|
||||
fun add(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> build(@BuilderInference g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
add(42)
|
||||
}
|
||||
|
||||
val memberWithoutAnn = wrongBuild {
|
||||
add(42)
|
||||
}
|
||||
|
||||
val extension = build {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
safeExtensionAdd("foo")
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class Builder<T> {
|
||||
fun add(t: T) {}
|
||||
}
|
||||
|
||||
fun <S> build(@BuilderInference g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
fun <S> wrongBuild(g: Builder<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
fun <S> Builder<S>.extensionAdd(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
fun <S> Builder<S>.safeExtensionAdd(s: S) {}
|
||||
|
||||
val member = build {
|
||||
add(42)
|
||||
}
|
||||
|
||||
val memberWithoutAnn = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER{NI}, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>wrongBuild<!> {
|
||||
add(42)
|
||||
}
|
||||
|
||||
val extension = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>build<!> {
|
||||
extensionAdd("foo")
|
||||
}
|
||||
|
||||
val safeExtension = build {
|
||||
safeExtensionAdd("foo")
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package
|
||||
|
||||
public val extension: [ERROR : Type for build {
|
||||
extensionAdd("foo")
|
||||
}]
|
||||
public val member: kotlin.collections.List<kotlin.Int>
|
||||
public val memberWithoutAnn: [ERROR : Type for wrongBuild {
|
||||
add(42)
|
||||
}]
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> build(/*0*/ @kotlin.BuilderInference g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> wrongBuild(/*0*/ g: Builder<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public fun </*0*/ S> Builder<S>.extensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
@kotlin.BuilderInference public fun </*0*/ S> Builder<S>.safeExtensionAdd(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class Builder</*0*/ T> {
|
||||
public constructor Builder</*0*/ T>()
|
||||
public final fun add(/*0*/ t: T): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
package kotlin {
|
||||
|
||||
public final annotation class BuilderInference : kotlin.Annotation {
|
||||
public constructor BuilderInference()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
suspend fun <S> GenericController<S>.extensionYield(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
suspend fun <S> GenericController<S>.safeExtensionYield(s: S) {}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val normal = generate {
|
||||
yield(42)
|
||||
}
|
||||
|
||||
val extension = generate {
|
||||
extensionYield("foo")
|
||||
}
|
||||
|
||||
val safeExtension = generate {
|
||||
safeExtensionYield("foo")
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// !LANGUAGE: +StableBuilderInference
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
// FILE: annotation.kt
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
// !WITH_NEW_INFERENCE
|
||||
|
||||
// FILE: annotation.kt
|
||||
|
||||
package kotlin
|
||||
|
||||
annotation class BuilderInference
|
||||
|
||||
// FILE: test.kt
|
||||
|
||||
class GenericController<T> {
|
||||
suspend fun yield(t: T) {}
|
||||
}
|
||||
|
||||
suspend fun <S> GenericController<S>.extensionYield(s: S) {}
|
||||
|
||||
@BuilderInference
|
||||
suspend fun <S> GenericController<S>.safeExtensionYield(s: S) {}
|
||||
|
||||
fun <S> generate(@BuilderInference g: suspend GenericController<S>.() -> Unit): List<S> = TODO()
|
||||
|
||||
val normal = generate {
|
||||
yield(42)
|
||||
}
|
||||
|
||||
val extension = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, TYPE_INFERENCE_NO_INFORMATION_FOR_PARAMETER{OI}!>generate<!> {
|
||||
extensionYield("foo")
|
||||
}
|
||||
|
||||
val safeExtension = generate {
|
||||
safeExtensionYield("foo")
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package
|
||||
|
||||
public val extension: [ERROR : Type for generate {
|
||||
extensionYield("foo")
|
||||
}]
|
||||
public val normal: kotlin.collections.List<kotlin.Int>
|
||||
public val safeExtension: kotlin.collections.List<kotlin.String>
|
||||
public fun </*0*/ S> generate(/*0*/ @kotlin.BuilderInference g: suspend GenericController<S>.() -> kotlin.Unit): kotlin.collections.List<S>
|
||||
public suspend fun </*0*/ S> GenericController<S>.extensionYield(/*0*/ s: S): kotlin.Unit
|
||||
@kotlin.BuilderInference public suspend fun </*0*/ S> GenericController<S>.safeExtensionYield(/*0*/ s: S): kotlin.Unit
|
||||
|
||||
public final class GenericController</*0*/ T> {
|
||||
public constructor GenericController</*0*/ T>()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
public final suspend fun yield(/*0*/ t: T): kotlin.Unit
|
||||
}
|
||||
|
||||
package kotlin {
|
||||
|
||||
public final annotation class BuilderInference : kotlin.Annotation {
|
||||
public constructor BuilderInference()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
Generated
+54
-24
@@ -12771,6 +12771,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/intersect.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("memberScope.kt")
|
||||
public void testMemberScope() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nullability.kt")
|
||||
public void testNullability() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/nullability.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("renderingStubTypes.kt")
|
||||
public void testRenderingStubTypes() throws Exception {
|
||||
@@ -32418,6 +32430,48 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
public void testCompleteIrrelevantCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/completeIrrelevantCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCallsWithRestrictions.kt")
|
||||
public void testIncorrectCallsWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInferenceWithRestrictions.kt")
|
||||
public void testResolveUsualCallWithBuilderInferenceWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtensionWithRestrictions.kt")
|
||||
public void testUseInferenceInformationFromExtensionWithRestrictions() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@Nested
|
||||
@@ -33608,18 +33662,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionsWithNonValuableConstraints_1_2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("incorrectCalls.kt")
|
||||
public void testIncorrectCalls() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/incorrectCalls.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferCoroutineTypeInOldVersion.kt")
|
||||
public void testInferCoroutineTypeInOldVersion() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/inferCoroutineTypeInOldVersion.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inferenceFromMethodInsideLocalVariable.kt")
|
||||
public void testInferenceFromMethodInsideLocalVariable() throws Exception {
|
||||
@@ -33764,12 +33806,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/recursiveGenerators2.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("resolveUsualCallWithBuilderInference.kt")
|
||||
public void testResolveUsualCallWithBuilderInference() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/resolveUsualCallWithBuilderInference.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("returnTypeInference.kt")
|
||||
public void testReturnTypeInference() throws Exception {
|
||||
@@ -33818,12 +33854,6 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/typeFromReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("useInferenceInformationFromExtension.kt")
|
||||
public void testUseInferenceInformationFromExtension() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/useInferenceInformationFromExtension.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("variableCallInsideBuilderFunction.kt")
|
||||
public void testVariableCallInsideBuilderFunction() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user