e8be9d4861
In this commit we upgrade FIR builder inference logic from the compiler version to 1.7. FIR-based compiler now works with "don't use builder inference" flag always ON and supports switching the flag "use builder inference only if needed". To do it, ContraintSystemCompleter (FIR) and KotlinConstraintSystemCompleter (FE 1.0) are made similar with extracting some common parts into ConstraintSystemCompletionContext. Test status: one BB test fails after this commit (KT-49285). Also we have a crush in DFA logic in FIR bootstrap test and somehow questionable behavior in FIR diagnostic test. However, two BB tests were fixed, the 3rd case from KT-49925 were also fixed. #KT-49925 Fixed
39 lines
730 B
Kotlin
Vendored
39 lines
730 B
Kotlin
Vendored
// ALLOW_KOTLIN_PACKAGE
|
|
// !LANGUAGE: +UnrestrictedBuilderInference
|
|
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
|
// 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!>wrongBuild<!> {
|
|
add(42)
|
|
}
|
|
|
|
val extension = build {
|
|
extensionAdd("foo")
|
|
}
|
|
|
|
val safeExtension = build {
|
|
safeExtensionAdd("foo")
|
|
}
|