Determine empty constraint system for a builder inference call by presense of not fixed type variables
This commit is contained in:
-36
@@ -1,36 +0,0 @@
|
||||
// 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("")
|
||||
val x: MutableList<CharSequence> = this@buildList
|
||||
}
|
||||
buildList {
|
||||
add(<!TYPE_MISMATCH, TYPE_MISMATCH!>""<!>)
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
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
|
||||
}
|
||||
+3
@@ -33,4 +33,7 @@ fun main() {
|
||||
add("")
|
||||
val x: StringBuilder = get(0)
|
||||
}
|
||||
buildMap {
|
||||
val x: Function2<String, Char, Char?> = ::put
|
||||
}
|
||||
}
|
||||
Vendored
+95
@@ -0,0 +1,95 @@
|
||||
// WITH_RUNTIME
|
||||
// !DIAGNOSTICS: -EXPERIMENTAL_API_USAGE_ERROR
|
||||
|
||||
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>): 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
|
||||
}
|
||||
|
||||
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
+19
@@ -0,0 +1,19 @@
|
||||
package
|
||||
|
||||
public fun </*0*/ K, /*1*/ V> build(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> V): kotlin.Unit
|
||||
public fun </*0*/ K, /*1*/ V> build2(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.() -> K): kotlin.Unit
|
||||
public fun </*0*/ K, /*1*/ V> build3(/*0*/ @kotlin.BuilderInference builderAction: kotlin.collections.MutableMap<K, V>.(K) -> kotlin.Unit): kotlin.Unit
|
||||
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> 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
|
||||
}
|
||||
Reference in New Issue
Block a user