K2: Use correct position for substitution constrains in builder inference
Before, we were wrapping the original constraint position into ConeBuilderInferenceSubstitutionConstraintPosition twice during the constraint substitution in builder inference. It was causing problems with diagnostic reporting. Remove TODOs about diagnostic reporting from FirBuilderInferenceSession. Propagation of errors from the common system is now implemented Diagnostic reporting in updateCalls isn't needed, since we report errors after the system completion unlike K1 Relates to KT-53749
This commit is contained in:
committed by
Space Team
parent
2f367b013a
commit
d46075a9db
Vendored
+3
-3
@@ -1,8 +1,8 @@
|
||||
// ISSUE: KT-55168
|
||||
fun foo(arg: Boolean) = <!NEW_INFERENCE_ERROR!>buildList {
|
||||
fun foo(arg: Boolean) = buildList {
|
||||
if (arg) {
|
||||
removeLast()
|
||||
} else {
|
||||
add(42)
|
||||
add(<!ARGUMENT_TYPE_MISMATCH!>42<!>)
|
||||
}
|
||||
}<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/inconsistentTypeInference.fir.kt:(62,127): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList<TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call into some call from position Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call into some call: kotlin/String <!: kotlin/Int].
|
||||
/inconsistentTypeInference.fir.kt:(62,127): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList<TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call from position Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call: kotlin/String <!: kotlin/Int].
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/inconsistentTypeInference2.fir.kt:(62,132): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList<TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call into some call from position Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call into some call: kotlin/String <!: kotlin/Int].
|
||||
/inconsistentTypeInference2.fir.kt:(62,132): error: New inference error [NewConstraintError at Incorporate kotlin/collections/MutableList<TypeVariable(E)> <: kotlin/collections/Collection<kotlin/Int> from Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call from position Incorporated builder inference constraint kotlin/collections/MutableList<Stub (chain inference): TypeVariable(E)> <: kotlin/collections/Collection<TypeVariable(T)> from Receiver this@R|special/anonymous| into some call: kotlin/String <!: kotlin/Int].
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ fun <T : Any> myBuilder(block: Foo<T>.() -> Unit) : Foo<T> = Foo<T>().apply(bloc
|
||||
|
||||
fun main(arg: Any) {
|
||||
val x = 57
|
||||
val value = <!NEW_INFERENCE_ERROR!>myBuilder {
|
||||
val value = <!TYPE_MISMATCH, TYPE_MISMATCH!>myBuilder {
|
||||
doSmthng("one ")
|
||||
run { a; this }.a = 10
|
||||
<!BUILDER_INFERENCE_STUB_RECEIVER!>a += 1<!>
|
||||
|
||||
Vendored
+6
-6
@@ -60,18 +60,18 @@ fun main(arg: Any, condition: Boolean) {
|
||||
}
|
||||
|
||||
// See KT-54664
|
||||
val value3 = <!NEW_INFERENCE_ERROR!>myBuilder {
|
||||
val value3 = myBuilder {
|
||||
accept("")
|
||||
a = 45
|
||||
bar(::a)
|
||||
}<!>
|
||||
bar(<!ARGUMENT_TYPE_MISMATCH, ARGUMENT_TYPE_MISMATCH!>::a<!>)
|
||||
}
|
||||
|
||||
fun baz(t: Int) {}
|
||||
|
||||
val value4 = <!NEW_INFERENCE_ERROR!>myBuilder {
|
||||
val value4 = myBuilder {
|
||||
accept("")
|
||||
a = 45
|
||||
b[0] = 123
|
||||
baz(a)
|
||||
}<!>
|
||||
baz(<!ARGUMENT_TYPE_MISMATCH!>a<!>)
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
/upperBoundViolation.fir.kt:(150,260): error: New inference error [NewConstraintError at Incorporate TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint Stub (chain inference): TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call into some call from position Incorporated builder inference constraint Stub (chain inference): TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call into some call: kotlin/String <!: kotlin/Number].
|
||||
/upperBoundViolation.fir.kt:(150,260): error: New inference error [NewConstraintError at Incorporate TypeVariable(E) <: kotlin/Number from Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call from position Incorporated builder inference constraint TypeVariable(T) <: kotlin/Number from DeclaredUpperBound into some call: kotlin/String <!: kotlin/Number].
|
||||
|
||||
Reference in New Issue
Block a user