FIR: copy builder inference session when creating snapshot for locals

This commit fixes one builder inference case from KT-49925
This commit is contained in:
Mikhail Glukhikh
2021-12-23 10:20:08 +03:00
committed by teamcity
parent 3f02309dad
commit f53cd22253
5 changed files with 11 additions and 7 deletions
@@ -19,8 +19,8 @@ FILE: buildSetWithVisitor.kt
public final fun R|Wrapper|.accept(visitor: R|AnyVisitor|): R|kotlin/Unit| {
R|<local>/visitor|.R|/AnyVisitor.visit|(this@R|/accept|)
}
public final fun bar(wrapper: R|Wrapper|): R|kotlin/collections/Set<ERROR CLASS: Cannot infer argument for type parameter E>| {
^bar <CS errors: kotlin/collections/buildSet>#<R|ERROR CLASS: Cannot infer argument for type parameter E|>(<L> = buildSet@fun R|kotlin/collections/MutableSet<ERROR CLASS: Cannot infer argument for type parameter E>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
public final fun bar(wrapper: R|Wrapper|): R|kotlin/collections/Set<kotlin/String>| {
^bar R|kotlin/collections/buildSet|<R|kotlin/String|>(<L> = buildSet@fun R|kotlin/collections/MutableSet<kotlin/String>|.<anonymous>(): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
R|<local>/wrapper|.R|/accept|(object : R|AnyVisitor| {
private constructor(): R|<anonymous>| {
super<R|AnyVisitor|>()
@@ -8,7 +8,7 @@ fun Wrapper.accept(visitor: AnyVisitor) {
visitor.visit(this)
}
fun bar(wrapper: Wrapper) = <!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>buildSet<!> {
fun bar(wrapper: Wrapper) = buildSet {
wrapper.accept(object : AnyVisitor() {
override fun visit(arg: Wrapper) {
add(arg.tag)