K2: Don't lose constraint errors in the builder inference session
Pass constraint errors from the integration system into a candidate to
make sure it is reported later.
Related to KT-59426, KT-59437
#KT-55168 Submitted
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt
index 2b4a6d7..a0ac202 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirBuilderInferenceSession.kt
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.fir.resolve.inference
+import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
@@ -13,6 +14,7 @@
import org.jetbrains.kotlin.fir.expressions.FirResolvable
import org.jetbrains.kotlin.fir.expressions.FirStatement
import org.jetbrains.kotlin.fir.expressions.*
+import org.jetbrains.kotlin.fir.languageVersionSettings
import org.jetbrains.kotlin.fir.resolve.calls.Candidate
import org.jetbrains.kotlin.fir.resolve.calls.ImplicitExtensionReceiverValue
import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext
@@ -115,7 +117,8 @@
override fun inferPostponedVariables(
lambda: ResolvedLambdaAtom,
constraintSystemBuilder: ConstraintSystemBuilder,
- completionMode: ConstraintSystemCompletionMode
+ completionMode: ConstraintSystemCompletionMode,
+ candidate: Candidate
): Map<ConeTypeVariableTypeConstructor, ConeKotlinType>? {
val (commonSystem, effectivelyEmptyConstraintSystem) = buildCommonSystem(constraintSystemBuilder.currentStorage())
val resultingSubstitutor by lazy { getResultingSubstitutor(commonSystem) }
@@ -140,6 +143,11 @@
constraintSystemBuilder.substituteFixedVariables(resultingSubstitutor)
}
+ if (!session.languageVersionSettings.supportsFeature(LanguageFeature.NoAdditionalErrorsInK1DiagnosticReporter)) {
+ for (error in commonSystem.errors) {
+ candidate.system.addError(error)
+ }
+ }
updateCalls(resultingSubstitutor)
@Suppress("UNCHECKED_CAST")
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt
index 8c20a0f..4e5283f 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirDelegatedPropertyInferenceSession.kt
@@ -79,7 +79,8 @@
override fun inferPostponedVariables(
lambda: ResolvedLambdaAtom,
constraintSystemBuilder: ConstraintSystemBuilder,
- completionMode: ConstraintSystemCompletionMode
+ completionMode: ConstraintSystemCompletionMode,
+ candidate: Candidate
): Map<ConeTypeVariableTypeConstructor, ConeKotlinType>? = null
fun completeCandidates(): List<FirResolvable> {
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirInferenceSession.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirInferenceSession.kt
index fdfd6b0..13c37c6 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirInferenceSession.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/FirInferenceSession.kt
@@ -39,7 +39,7 @@
lambda: ResolvedLambdaAtom,
constraintSystemBuilder: ConstraintSystemBuilder,
completionMode: ConstraintSystemCompletionMode,
- // TODO: diagnostic holder
+ candidate: Candidate
): Map<ConeTypeVariableTypeConstructor, ConeKotlinType>?
abstract fun clear()
@@ -55,7 +55,8 @@
override fun inferPostponedVariables(
lambda: ResolvedLambdaAtom,
constraintSystemBuilder: ConstraintSystemBuilder,
- completionMode: ConstraintSystemCompletionMode
+ completionMode: ConstraintSystemCompletionMode,
+ candidate: Candidate
): Map<ConeTypeVariableTypeConstructor, ConeKotlinType>? = null
override fun registerStubTypes(map: Map<TypeVariableMarker, StubTypeMarker>) {}
diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
index 7d55da9..da59c99 100644
--- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
+++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/inference/PostponedArgumentsAnalyzer.kt
@@ -214,7 +214,7 @@
c.resolveForkPointsConstraints()
if (inferenceSession != null) {
- val postponedVariables = inferenceSession.inferPostponedVariables(lambda, builder, completionMode)
+ val postponedVariables = inferenceSession.inferPostponedVariables(lambda, builder, completionMode, candidate)
if (postponedVariables == null) {
builder.removePostponedVariables()
diff --git a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/inference/model/FirConstraintPositionAndErrors.kt b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/inference/model/FirConstraintPositionAndErrors.kt
index 18da64d..37b1331 100644
--- a/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/inference/model/FirConstraintPositionAndErrors.kt
+++ b/compiler/fir/semantics/src/org/jetbrains/kotlin/fir/resolve/inference/model/FirConstraintPositionAndErrors.kt
@@ -8,28 +8,52 @@
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.declarations.FirAnonymousFunction
import org.jetbrains.kotlin.fir.expressions.FirExpression
+import org.jetbrains.kotlin.fir.render
+import org.jetbrains.kotlin.fir.types.ConeTypeVariable
import org.jetbrains.kotlin.fir.types.FirTypeProjection
import org.jetbrains.kotlin.resolve.calls.inference.model.*
import org.jetbrains.kotlin.types.model.TypeVariableMarker
-class ConeDeclaredUpperBoundConstraintPosition : DeclaredUpperBoundConstraintPosition<Nothing?>(null)
+class ConeDeclaredUpperBoundConstraintPosition : DeclaredUpperBoundConstraintPosition<Nothing?>(null) {
+ override fun toString(): String = "DeclaredUpperBound"
+}
-class ConeFixVariableConstraintPosition(variable: TypeVariableMarker) : FixVariableConstraintPosition<Nothing?>(variable, null)
+class ConeFixVariableConstraintPosition(variable: TypeVariableMarker) : FixVariableConstraintPosition<Nothing?>(variable, null) {
+ override fun toString(): String = "Fix variable ${(variable as ConeTypeVariable).typeConstructor.name}"
+}
-class ConeArgumentConstraintPosition(argument: FirElement) : ArgumentConstraintPosition<FirElement>(argument)
+class ConeArgumentConstraintPosition(argument: FirElement) : ArgumentConstraintPosition<FirElement>(argument) {
+ override fun toString(): String {
+ return "Argument ${argument.render()}"
+ }
+}
-object ConeExpectedTypeConstraintPosition : ExpectedTypeConstraintPosition<Nothing?>(null)
+object ConeExpectedTypeConstraintPosition : ExpectedTypeConstraintPosition<Nothing?>(null) {
+ override fun toString(): String = "ExpectedType for some call"
+}
class ConeExplicitTypeParameterConstraintPosition(
typeArgument: FirTypeProjection,
-) : ExplicitTypeParameterConstraintPosition<FirTypeProjection>(typeArgument)
+) : ExplicitTypeParameterConstraintPosition<FirTypeProjection>(typeArgument) {
+ override fun toString(): String = "TypeParameter ${typeArgument.render()}"
+}
class ConeLambdaArgumentConstraintPosition(
anonymousFunction: FirAnonymousFunction
-) : LambdaArgumentConstraintPosition<FirAnonymousFunction>(anonymousFunction)
+) : LambdaArgumentConstraintPosition<FirAnonymousFunction>(anonymousFunction) {
+ override fun toString(): String {
+ return "LambdaArgument"
+ }
+}
class ConeBuilderInferenceSubstitutionConstraintPosition(initialConstraint: InitialConstraint) :
- BuilderInferenceSubstitutionConstraintPosition<Nothing?>(null, initialConstraint) // TODO
+ BuilderInferenceSubstitutionConstraintPosition<Nothing?>(null, initialConstraint) {
+ override fun toString(): String = "Incorporated builder inference constraint $initialConstraint " +
+ "into some call"
+}
-class ConeReceiverConstraintPosition(receiver: FirExpression) : ReceiverConstraintPosition<FirExpression>(receiver)
+class ConeReceiverConstraintPosition(receiver: FirExpression) : ReceiverConstraintPosition<FirExpression>(receiver) {
+ override fun toString(): String = "Receiver ${argument.render()}"
+
+}
diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt
index cfd7f7b..684db09 100644
--- a/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt
+++ b/compiler/testData/diagnostics/tests/inference/builderInference/constraints/violating.fir.kt
@@ -13,10 +13,10 @@
override fun foo(): MutableList<String> = <!RETURN_TYPE_MISMATCH!>this@buildList<!>
}
}
- buildList {
+ <!NEW_INFERENCE_ERROR!>buildList {
add(3)
val x: String = <!INITIALIZER_TYPE_MISMATCH!>get(0)<!>
- }
+ }<!>
buildList {
add("3")
val x: MutableList<Int> = <!INITIALIZER_TYPE_MISMATCH!>this@buildList<!>
@@ -26,8 +26,8 @@
add(y)
val x: MutableList<String> = <!INITIALIZER_TYPE_MISMATCH!>this@buildList<!>
}
- buildList {
+ <!NEW_INFERENCE_ERROR!>buildList {
add("")
val x: StringBuilder = <!INITIALIZER_TYPE_MISMATCH!>get(0)<!>
- }
+ }<!>
}
diff --git a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt
index b7a9a95..70a144f 100644
--- a/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt
+++ b/compiler/testData/diagnostics/tests/inference/builderInference/stubTypes/memberScope.fir.kt
@@ -17,7 +17,7 @@
fun Any?.test2() {}
fun test() {
- val ret1 = build {
+ val ret1 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
get()?.test()
@@ -27,8 +27,8 @@
get()?.<!NONE_APPLICABLE!>equals<!>(1)
// there is `String?.equals` extension
get().equals("")
- }
- val ret2 = build {
+ }<!>
+ val ret2 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
get()?.test()
@@ -40,8 +40,8 @@
x?.hashCode()
x?.<!NONE_APPLICABLE!>equals<!>(1)
x.equals("")
- }
- val ret3 = build {
+ }<!>
+ val ret3 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
get()?.test()
@@ -68,7 +68,7 @@
}
""
- }
+ }<!>
val ret4 = build {
emit(1)
emit(null)
@@ -149,15 +149,15 @@
""
}
- val ret408 = build {
+ val ret408 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
val x = get()
x.test()
""
- }
- val ret41 = build {
+ }<!>
+ val ret41 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
get()?.test()
@@ -205,7 +205,7 @@
}
""
- }
+ }<!>
val ret5 = build {
emit(1)
emit(null)
@@ -280,14 +280,14 @@
}
""
}
- val ret508 = build {
+ val ret508 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
val x = get()
x.test()
""
- }
- val ret51 = build {
+ }<!>
+ val ret51 = <!NEW_INFERENCE_ERROR!>build {
emit(1)
emit(null)
get()?.test()
@@ -310,5 +310,5 @@
}
""
- }
+ }<!>
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt
index 59e95ba..59d0121 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/buildListRemoveAddInBranches.fir.kt
@@ -1,8 +1,8 @@
// ISSUE: KT-55168
-fun foo(arg: Boolean) = buildList {
+fun foo(arg: Boolean) = <!NEW_INFERENCE_ERROR!>buildList {
if (arg) {
removeLast()
} else {
add(42)
}
-}
+}<!>
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt
new file mode 100644
index 0000000..c66826a
--- /dev/null
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.diag.txt
@@ -0,0 +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].
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.kt
index a54823d..d421f36 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.kt
@@ -2,9 +2,9 @@
// FIR_DUMP
fun foo() {
- buildList {
+ <!NEW_INFERENCE_ERROR!>buildList {
add("Boom")
println(plus(1)[0])
- }
+ }<!>
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt
index 82139b9..9db449a 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference.fir.txt
@@ -1,6 +1,6 @@
FILE: inconsistentTypeInference.fir.kt
public final fun foo(): R|kotlin/Unit| {
- R|kotlin/collections/buildList|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
+ R|kotlin/collections/buildList<CS errors: kotlin/collections/buildList>#|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus|<R|kotlin/Int|>(Int(1)).R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/Int|>|(Int(0)))
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt
new file mode 100644
index 0000000..8da0067
--- /dev/null
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.diag.txt
@@ -0,0 +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].
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.kt
index 914030a..b6445cd 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.kt
@@ -2,8 +2,8 @@
// FIR_DUMP
fun bar() {
- buildList {
+ <!NEW_INFERENCE_ERROR!>buildList {
add("Boom")
println(this.plus(1)[0])
- }
-}
\ No newline at end of file
+ }<!>
+}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt
index 7f74bfb..160d14f 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/inconsistentTypeInference2.fir.txt
@@ -1,6 +1,6 @@
FILE: inconsistentTypeInference2.fir.kt
public final fun bar(): R|kotlin/Unit| {
- R|kotlin/collections/buildList|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
+ R|kotlin/collections/buildList<CS errors: kotlin/collections/buildList>#|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
R|kotlin/io/println|(this@R|special/anonymous|.R|kotlin/collections/plus|<R|kotlin/Int|>(Int(1)).R|SubstitutionOverride<kotlin/collections/List.get: R|kotlin/Int|>|(Int(0)))
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt
index 50c554a..4d1d33c 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignment.fir.kt
@@ -7,7 +7,7 @@
fun main(arg: Any) {
val x = 57
- val value = myBuilder {
+ val value = <!NEW_INFERENCE_ERROR!>myBuilder {
doSmthng("one ")
run { a; this }.a = 10
a += 1
@@ -19,6 +19,6 @@
if (arg is String) {
a = arg
}
- }
+ }<!>
<!OVERLOAD_RESOLUTION_AMBIGUITY!>println<!>(value.a?.<!UNRESOLVED_REFERENCE!>count<!> { <!UNRESOLVED_REFERENCE!>it<!> in 'l' .. 'q' })
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt
index 8fad616..ad9651d 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.kt
@@ -60,18 +60,18 @@
}
// See KT-54664
- val value3 = myBuilder {
+ val value3 = <!NEW_INFERENCE_ERROR!>myBuilder {
accept("")
a = 45
bar(::a)
- }
+ }<!>
fun baz(t: Int) {}
- val value4 = myBuilder {
+ val value4 = <!NEW_INFERENCE_ERROR!>myBuilder {
accept("")
a = 45
b[0] = 123
baz(a)
- }
+ }<!>
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt
index 09adea5..0de1e0a 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/unsafeAssignmentExtra.fir.txt
@@ -91,7 +91,7 @@
}
)
- lval value3: R|Foo<kotlin/Int>| = R|/myBuilder|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
+ lval value3: R|Foo<kotlin/Int>| = R|/myBuilder<CS errors: /myBuilder>#|<R|kotlin/Int|>(<L> = myBuilder@fun R|Foo<kotlin/Int>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
R|/bar|(::R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>|)
@@ -100,7 +100,7 @@
local final fun baz(t: R|kotlin/Int|): R|kotlin/Unit| {
}
- lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
+ lval value4: R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>| = R|/myBuilder<CS errors: /myBuilder>#|<R|it(kotlin/Comparable<*> & java/io/Serializable)|>(<L> = myBuilder@fun R|Foo<it(kotlin/Comparable<*> & java/io/Serializable)>|.<anonymous>(): R|kotlin/Unit| <inline=NoInline> {
this@R|special/anonymous|.R|SubstitutionOverride</Foo.accept: R|kotlin/Unit|>|(String())
this@R|special/anonymous|.R|SubstitutionOverride</Foo.a: R|Stub (chain inference): TypeVariable(T)|>| = Int(45)
this@R|special/anonymous|.R|SubstitutionOverride</Foo.b: R|kotlin/Array<Stub (chain inference): TypeVariable(T)>|>|.R|SubstitutionOverride<kotlin/Array.set: R|kotlin/Unit|>|(Int(0), Int(123))
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt
new file mode 100644
index 0000000..43456d8
--- /dev/null
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.diag.txt
@@ -0,0 +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].
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.kt
index d2aa03e..30bcd34 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.kt
@@ -4,8 +4,8 @@
fun <T : Number> printGenericNumber(t: T) = println("Number is $t")
fun main() {
- buildList { // inferred into MutableList<String>
+ <!NEW_INFERENCE_ERROR!>buildList { // inferred into MutableList<String>
add("Boom")
printGenericNumber(this[0])
- }
+ }<!>
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt
index a1bd80e..178c1a1 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt
+++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/upperBoundViolation.fir.txt
@@ -3,7 +3,7 @@
^printGenericNumber R|kotlin/io/println|(<strcat>(String(Number is ), R|<local>/t|))
}
public final fun main(): R|kotlin/Unit| {
- R|kotlin/collections/buildList|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
+ R|kotlin/collections/buildList<CS errors: kotlin/collections/buildList>#|<R|kotlin/String|>(<L> = buildList@fun R|kotlin/collections/MutableList<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.add: R|kotlin/Boolean|>|(String(Boom))
R|/printGenericNumber|<R|kotlin/String|>(this@R|special/anonymous|.R|SubstitutionOverride<kotlin/collections/MutableList.get: R|Stub (chain inference): TypeVariable(E)|>|(Int(0)))
}
diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt
index c5dd98d..e2af7d4 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/extensionWithNonValuableConstraints.fir.kt
@@ -50,10 +50,10 @@
invNullableAnyExtension()
}
-val test7 = generate {
+val test7 = <!NEW_INFERENCE_ERROR!>generate {
yield("baz")
genericExtension<Int>()
-}
+}<!>
val test8 = generate {
safeExtension()
diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt
index 2ec35f5..a893394 100644
--- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt
+++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/kt35684.fir.kt
@@ -12,8 +12,8 @@
}
fun test_2() {
- <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
- yield(materialize())
+ <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER, NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>sequence<!> {
+ yield(<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>materialize<!>())
}
}