diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt index eb321e5d6dd..ced8df9b17f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/ResolveUtils.kt @@ -215,7 +215,7 @@ fun FirFunction<*>.constructFunctionalTypeRef(session: FirSession): FirResolvedT } val rawReturnType = (this as FirTypedDeclaration).returnTypeRef.coneTypeUnsafe() - val functionalType = createFunctionalType(parameters, receiverTypeRef?.coneTypeUnsafe(), rawReturnType) + val functionalType = createFunctionalType(parameters, receiverTypeRef?.coneTypeSafe(), rawReturnType) return FirResolvedTypeRefImpl(source, functionalType) } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt index 808f326eae2..2959e1fdc5c 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt @@ -70,6 +70,13 @@ open class FirBodyResolveTransformer( return expressionsTransformer.transformExpression(expression, data) } + override fun transformWrappedArgumentExpression( + wrappedArgumentExpression: FirWrappedArgumentExpression, + data: ResolutionMode + ): CompositeTransformResult { + return (wrappedArgumentExpression.transformChildren(this, data) as FirStatement).compose() + } + override fun transformQualifiedAccessExpression( qualifiedAccessExpression: FirQualifiedAccessExpression, data: ResolutionMode diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index fdab2414d99..dc746d35907 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -289,8 +289,8 @@ class FirDeclarationsResolveTransformer(transformer: FirBodyResolveTransformer) } val label = anonymousFunction.label - return if (label != null && receiverTypeRef != null) { - withLabelAndReceiverType(Name.identifier(label.name), anonymousFunction, receiverTypeRef.coneTypeUnsafe()) { + return if (label != null && receiverTypeRef is FirResolvedTypeRef) { + withLabelAndReceiverType(Name.identifier(label.name), anonymousFunction, receiverTypeRef.type) { transform() } } else { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index 35cf30b0248..9cd5b9f4158 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -159,7 +159,11 @@ class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransformer) : // name.invoke() case callCompleter.completeCall(resultExplicitReceiver, noExpectedType) } - callCompleter.completeCall(resultExpression, expectedTypeRef) + val completionResult = callCompleter.completeCall(resultExpression, expectedTypeRef) + if (completionResult.typeRef is FirErrorTypeRef) { + completionResult.transformArguments(transformer, ResolutionMode.LambdaResolution(null)) + } + completionResult } catch (e: Throwable) { throw RuntimeException("While resolving call ${functionCall.render()}", e) } diff --git a/compiler/fir/resolve/testData/resolve/arguments/lambda.txt b/compiler/fir/resolve/testData/resolve/arguments/lambda.txt index 65b9430265d..67ffe9d8bd9 100644 --- a/compiler/fir/resolve/testData/resolve/arguments/lambda.txt +++ b/compiler/fir/resolve/testData/resolve/arguments/lambda.txt @@ -18,14 +18,14 @@ FILE: lambda.kt Unit } ) - #(Int(1), = foo@fun .(): { + #(Int(1), = foo@fun .(): R|kotlin/Unit| { Unit } ) - #(f = foo@fun .(): { + #(f = foo@fun .(): R|kotlin/Unit| { Unit } - , = foo@fun .(): { + , = foo@fun .(): R|kotlin/Unit| { Unit } ) @@ -45,11 +45,11 @@ FILE: lambda.kt Unit } ) - #( = bar@fun .(): { + #( = bar@fun .(): R|kotlin/Unit| { Unit } ) - #(bar@fun .(): { + #(bar@fun .(): R|kotlin/Unit| { Unit } ) @@ -61,15 +61,15 @@ FILE: lambda.kt Unit } , Boolean(false)) - #( = baz@fun .(): { + #( = baz@fun .(): R|kotlin/Unit| { Unit } ) - #( = baz@fun .(): { + #( = baz@fun .(): R|kotlin/Unit| { Unit } ) - #(other = Boolean(false), = baz@fun .(): { + #(other = Boolean(false), = baz@fun .(): R|kotlin/Unit| { Unit } ) diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index d1a5721600e..e4ee21436c6 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -26,57 +26,61 @@ digraph complex_kt { 10 [label="Enter block"]; 11 [label="Access variable #"]; 12 [label="Access variable R|/url|"]; - 13 [label="Function call: #.#(R|/url|)"]; - 14 [label="Function call: #.#(R|/url|).#( = connect@fun .(): { - GsonBuilder#().create#().fromJson#(it#.inputStream#.reader#(), (Array#()).java#) + 13 [label="Access variable R|/url|"]; + 14 [label="Function call: #.#(R|/url|)"]; + 15 [label="Function call: #.#(R|/url|).#( = connect@fun .(): { + #().#().#(#.#.#(), (#()).#) } )"]; - 15 [label="Exit block"]; + 16 [label="Exit block"]; } - 16 [label="Try main block exit"]; + 17 [label="Try main block exit"]; } subgraph cluster_5 { color=blue - 17 [label="Catch enter"]; + 18 [label="Catch enter"]; subgraph cluster_6 { color=blue - 18 [label="Enter block"]; - 19 [label="Const: String(Can't parse json response)"]; - 20 [label="Access variable R|/syntaxException|"]; - 21 [label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; - 22 [label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; - 23 [label="Stub" style="filled" fillcolor=gray]; - 24 [label="Exit block" style="filled" fillcolor=gray]; + 19 [label="Enter block"]; + 20 [label="Const: String(Can't parse json response)"]; + 21 [label="Access variable R|/syntaxException|"]; + 22 [label="Const: String(Can't parse json response)"]; + 23 [label="Access variable R|/syntaxException|"]; + 24 [label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; + 25 [label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; + 26 [label="Stub" style="filled" fillcolor=gray]; + 27 [label="Exit block" style="filled" fillcolor=gray]; } - 25 [label="Catch exit" style="filled" fillcolor=gray]; + 28 [label="Catch exit" style="filled" fillcolor=gray]; } subgraph cluster_7 { color=blue - 26 [label="Catch enter"]; + 29 [label="Catch enter"]; subgraph cluster_8 { color=blue - 27 [label="Enter block"]; - 28 [label="Access variable R|/ioException|"]; - 29 [label="Function call: #(R|/ioException|)"]; - 30 [label="Throw: throw #(R|/ioException|)"]; - 31 [label="Stub" style="filled" fillcolor=gray]; - 32 [label="Exit block" style="filled" fillcolor=gray]; + 30 [label="Enter block"]; + 31 [label="Access variable R|/ioException|"]; + 32 [label="Access variable R|/ioException|"]; + 33 [label="Function call: #(R|/ioException|)"]; + 34 [label="Throw: throw #(R|/ioException|)"]; + 35 [label="Stub" style="filled" fillcolor=gray]; + 36 [label="Exit block" style="filled" fillcolor=gray]; } - 33 [label="Catch exit" style="filled" fillcolor=gray]; + 37 [label="Catch exit" style="filled" fillcolor=gray]; } - 34 [label="Try expression exit"]; + 38 [label="Try expression exit"]; } - 35 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; - 36 [label="Exit block"]; + 39 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; + 40 [label="Exit block"]; } subgraph cluster_9 { color=blue - 37 [label="Enter annotation"]; - 38 [label="Access variable #"]; - 39 [label="Access variable #"]; - 40 [label="Exit annotation"]; + 41 [label="Enter annotation"]; + 42 [label="Access variable #"]; + 43 [label="Access variable #"]; + 44 [label="Exit annotation"]; } - 41 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; + 45 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; } 0 -> {1}; @@ -88,133 +92,170 @@ digraph complex_kt { 6 -> {7}; 7 -> {8}; 8 -> {9}; - 9 -> {41 26 17 10}; + 9 -> {45 29 18 10}; 10 -> {11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; - 16 -> {34}; - 17 -> {41 18}; - 18 -> {19}; + 16 -> {17}; + 17 -> {38}; + 18 -> {45 19}; 19 -> {20}; 20 -> {21}; 21 -> {22}; - 22 -> {41}; - 22 -> {23} [style=dotted]; - 23 -> {24} [style=dotted]; - 24 -> {25} [style=dotted]; - 25 -> {34} [style=dotted]; - 26 -> {41 27}; - 27 -> {28}; - 28 -> {29}; - 29 -> {30}; - 30 -> {41}; - 30 -> {31} [style=dotted]; - 31 -> {32} [style=dotted]; - 32 -> {33} [style=dotted]; - 33 -> {34} [style=dotted]; - 34 -> {35}; - 35 -> {36}; - 36 -> {37}; - 37 -> {38}; + 22 -> {23}; + 23 -> {24}; + 24 -> {25}; + 25 -> {45}; + 25 -> {26} [style=dotted]; + 26 -> {27} [style=dotted]; + 27 -> {28} [style=dotted]; + 28 -> {38} [style=dotted]; + 29 -> {45 30}; + 30 -> {31}; + 31 -> {32}; + 32 -> {33}; + 33 -> {34}; + 34 -> {45}; + 34 -> {35} [style=dotted]; + 35 -> {36} [style=dotted]; + 36 -> {37} [style=dotted]; + 37 -> {38} [style=dotted]; 38 -> {39}; 39 -> {40}; 40 -> {41}; + 41 -> {42}; + 42 -> {43}; + 43 -> {44}; + 44 -> {45}; subgraph cluster_10 { color=red - 42 [label="Enter function close" style="filled" fillcolor=red]; - 43 [label="Exit function close" style="filled" fillcolor=red]; + 46 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + subgraph cluster_11 { + color=blue + 47 [label="Enter block"]; + 48 [label="Function call: #()"]; + 49 [label="Function call: #().#()"]; + 50 [label="Access variable #"]; + 51 [label="Access variable #"]; + 52 [label="Function call: #.#.#()"]; + 53 [label="Function call: #()"]; + 54 [label="Access variable #"]; + 55 [label="Access variable #"]; + 56 [label="Function call: #().#().#(#.#.#(), (#()).#)"]; + 57 [label="Exit block"]; + } + 58 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 42 -> {43}; + 46 -> {47}; + 47 -> {48}; + 48 -> {49}; + 49 -> {50}; + 50 -> {51}; + 51 -> {52}; + 52 -> {53}; + 53 -> {54}; + 54 -> {55}; + 55 -> {56}; + 56 -> {57}; + 57 -> {58}; - subgraph cluster_11 { + subgraph cluster_12 { color=red - 44 [label="Enter function closeFinally" style="filled" fillcolor=red]; - subgraph cluster_12 { + 59 [label="Enter function close" style="filled" fillcolor=red]; + 60 [label="Exit function close" style="filled" fillcolor=red]; + } + + 59 -> {60}; + + subgraph cluster_13 { + color=red + 61 [label="Enter function closeFinally" style="filled" fillcolor=red]; + subgraph cluster_14 { color=blue - 45 [label="Enter block"]; - subgraph cluster_13 { + 62 [label="Enter block"]; + subgraph cluster_15 { color=blue - 46 [label="Enter when"]; - subgraph cluster_14 { - color=blue - 47 [label="Enter when branch condition "]; - 48 [label="Access variable this@R|/closeFinally|"]; - 49 [label="Const: Null(null)"]; - 50 [label="Operator =="]; - 51 [label="Exit when branch condition"]; - } - subgraph cluster_15 { - color=blue - 52 [label="Enter when branch condition "]; - 53 [label="Access variable R|/cause|"]; - 54 [label="Const: Null(null)"]; - 55 [label="Operator =="]; - 56 [label="Exit when branch condition"]; - } + 63 [label="Enter when"]; subgraph cluster_16 { color=blue - 57 [label="Enter when branch condition else"]; - 58 [label="Exit when branch condition"]; + 64 [label="Enter when branch condition "]; + 65 [label="Access variable this@R|/closeFinally|"]; + 66 [label="Const: Null(null)"]; + 67 [label="Operator =="]; + 68 [label="Exit when branch condition"]; } - 59 [label="Enter when branch result"]; subgraph cluster_17 { color=blue - 60 [label="Enter block"]; - subgraph cluster_18 { + 69 [label="Enter when branch condition "]; + 70 [label="Access variable R|/cause|"]; + 71 [label="Const: Null(null)"]; + 72 [label="Operator =="]; + 73 [label="Exit when branch condition"]; + } + subgraph cluster_18 { + color=blue + 74 [label="Enter when branch condition else"]; + 75 [label="Exit when branch condition"]; + } + 76 [label="Enter when branch result"]; + subgraph cluster_19 { + color=blue + 77 [label="Enter block"]; + subgraph cluster_20 { color=blue - 61 [label="Try expression enter"]; - subgraph cluster_19 { - color=blue - 62 [label="Try main block enter"]; - subgraph cluster_20 { - color=blue - 63 [label="Enter block"]; - 64 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; - 65 [label="Exit block"]; - } - 66 [label="Try main block exit"]; - } + 78 [label="Try expression enter"]; subgraph cluster_21 { color=blue - 67 [label="Catch enter"]; + 79 [label="Try main block enter"]; subgraph cluster_22 { color=blue - 68 [label="Enter block"]; - 69 [label="Access variable R|/cause|"]; - 70 [label="Access variable R|/closeException|"]; - 71 [label="Function call: R|/cause|.R|kotlin/addSuppressed|(R|/closeException|)"]; - 72 [label="Exit block"]; + 80 [label="Enter block"]; + 81 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; + 82 [label="Exit block"]; } - 73 [label="Catch exit"]; + 83 [label="Try main block exit"]; } - 74 [label="Try expression exit"]; + subgraph cluster_23 { + color=blue + 84 [label="Catch enter"]; + subgraph cluster_24 { + color=blue + 85 [label="Enter block"]; + 86 [label="Access variable R|/cause|"]; + 87 [label="Access variable R|/closeException|"]; + 88 [label="Function call: R|/cause|.R|kotlin/addSuppressed|(R|/closeException|)"]; + 89 [label="Exit block"]; + } + 90 [label="Catch exit"]; + } + 91 [label="Try expression exit"]; } - 75 [label="Exit block"]; + 92 [label="Exit block"]; } - 76 [label="Exit when branch result"]; - 77 [label="Enter when branch result"]; - subgraph cluster_23 { + 93 [label="Exit when branch result"]; + 94 [label="Enter when branch result"]; + subgraph cluster_25 { color=blue - 78 [label="Enter block"]; - 79 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; - 80 [label="Exit block"]; + 95 [label="Enter block"]; + 96 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; + 97 [label="Exit block"]; } - 81 [label="Exit when branch result"]; - 82 [label="Enter when branch result"]; - subgraph cluster_24 { + 98 [label="Exit when branch result"]; + 99 [label="Enter when branch result"]; + subgraph cluster_26 { color=blue - 83 [label="Enter block"]; - 84 [label="Exit block"]; + 100 [label="Enter block"]; + 101 [label="Exit block"]; } - 85 [label="Exit when branch result"]; - 86 [label="Exit when"]; + 102 [label="Exit when branch result"]; + 103 [label="Exit when"]; } - 87 [label="Jump: ^closeFinally when () { + 104 [label="Jump: ^closeFinally when () { ==(this@R|/closeFinally|, Null(null)) -> { } ==(R|/cause|, Null(null)) -> { @@ -231,166 +272,166 @@ digraph complex_kt { } } "]; - 88 [label="Stub" style="filled" fillcolor=gray]; - 89 [label="Exit block" style="filled" fillcolor=gray]; + 105 [label="Stub" style="filled" fillcolor=gray]; + 106 [label="Exit block" style="filled" fillcolor=gray]; } - 90 [label="Exit function closeFinally" style="filled" fillcolor=red]; + 107 [label="Exit function closeFinally" style="filled" fillcolor=red]; } - 44 -> {45}; - 45 -> {46}; - 46 -> {47}; - 47 -> {48}; - 48 -> {49}; - 49 -> {50}; - 50 -> {51}; - 51 -> {82 52}; - 52 -> {53}; - 53 -> {54}; - 54 -> {55}; - 55 -> {56}; - 56 -> {77 57}; - 57 -> {58}; - 58 -> {59}; - 59 -> {60}; - 60 -> {61}; 61 -> {62}; - 62 -> {90 67 63}; + 62 -> {63}; 63 -> {64}; 64 -> {65}; 65 -> {66}; - 66 -> {74}; - 67 -> {90 68}; - 68 -> {69}; + 66 -> {67}; + 67 -> {68}; + 68 -> {99 69}; 69 -> {70}; 70 -> {71}; 71 -> {72}; 72 -> {73}; - 73 -> {74}; + 73 -> {94 74}; 74 -> {75}; 75 -> {76}; - 76 -> {86}; + 76 -> {77}; 77 -> {78}; 78 -> {79}; - 79 -> {80}; + 79 -> {107 84 80}; 80 -> {81}; - 81 -> {86}; + 81 -> {82}; 82 -> {83}; - 83 -> {84}; - 84 -> {85}; + 83 -> {91}; + 84 -> {107 85}; 85 -> {86}; 86 -> {87}; - 87 -> {90}; - 87 -> {88} [style=dotted]; - 88 -> {89} [style=dotted]; - 89 -> {90} [style=dotted]; - - subgraph cluster_25 { - color=red - 91 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; - subgraph cluster_26 { - color=blue - 92 [label="Enter block"]; - 93 [label="Access variable this@R|/firstIsInstanceOrNull|"]; - 94 [label="Variable declaration: lval : R|kotlin/sequences/Sequence<*>|"]; - 95 [label="Access variable R|/|"]; - 96 [label="Function call: R|/|.R|kotlin/sequences/Sequence.iterator|()"]; - 97 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; - subgraph cluster_27 { - color=blue - 98 [label="Enter while loop"]; - subgraph cluster_28 { - color=blue - 99 [label="Enter loop condition"]; - 100 [label="Access variable R|/|"]; - 101 [label="Function call: R|/|.R|kotlin/collections/Iterator.hasNext|()"]; - 102 [label="Exit loop condition"]; - } - subgraph cluster_29 { - color=blue - 103 [label="Enter loop block"]; - subgraph cluster_30 { - color=blue - 104 [label="Enter block"]; - 105 [label="Access variable R|/|"]; - 106 [label="Function call: R|/|.R|FakeOverride|()"]; - 107 [label="Variable declaration: lval element: R|T|"]; - subgraph cluster_31 { - color=blue - 108 [label="Enter when"]; - subgraph cluster_32 { - color=blue - 109 [label="Enter when branch condition "]; - 110 [label="Access variable R|/element|"]; - 111 [label="Type operator: element is T"]; - 112 [label="Exit when branch condition"]; - } - 113 [label="Synthetic else branch"]; - 114 [label="Enter when branch result"]; - subgraph cluster_33 { - color=blue - 115 [label="Enter block"]; - 116 [label="Access variable R|/element|"]; - 117 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; - 118 [label="Stub" style="filled" fillcolor=gray]; - 119 [label="Exit block" style="filled" fillcolor=gray]; - } - 120 [label="Exit when branch result" style="filled" fillcolor=gray]; - 121 [label="Exit when"]; - } - 122 [label="Exit block"]; - } - 123 [label="Exit loop block"]; - } - 124 [label="Exit whileloop"]; - } - 125 [label="Const: Null(null)"]; - 126 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; - 127 [label="Stub" style="filled" fillcolor=gray]; - 128 [label="Exit block" style="filled" fillcolor=gray]; - } - 129 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; - } - + 87 -> {88}; + 88 -> {89}; + 89 -> {90}; + 90 -> {91}; 91 -> {92}; 92 -> {93}; - 93 -> {94}; + 93 -> {103}; 94 -> {95}; 95 -> {96}; 96 -> {97}; 97 -> {98}; - 98 -> {99}; + 98 -> {103}; 99 -> {100}; 100 -> {101}; 101 -> {102}; - 102 -> {124 103}; + 102 -> {103}; 103 -> {104}; - 104 -> {105}; - 105 -> {106}; - 106 -> {107}; - 107 -> {108}; + 104 -> {107}; + 104 -> {105} [style=dotted]; + 105 -> {106} [style=dotted]; + 106 -> {107} [style=dotted]; + + subgraph cluster_27 { + color=red + 108 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; + subgraph cluster_28 { + color=blue + 109 [label="Enter block"]; + 110 [label="Access variable this@R|/firstIsInstanceOrNull|"]; + 111 [label="Variable declaration: lval : R|kotlin/sequences/Sequence<*>|"]; + 112 [label="Access variable R|/|"]; + 113 [label="Function call: R|/|.R|kotlin/sequences/Sequence.iterator|()"]; + 114 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; + subgraph cluster_29 { + color=blue + 115 [label="Enter while loop"]; + subgraph cluster_30 { + color=blue + 116 [label="Enter loop condition"]; + 117 [label="Access variable R|/|"]; + 118 [label="Function call: R|/|.R|kotlin/collections/Iterator.hasNext|()"]; + 119 [label="Exit loop condition"]; + } + subgraph cluster_31 { + color=blue + 120 [label="Enter loop block"]; + subgraph cluster_32 { + color=blue + 121 [label="Enter block"]; + 122 [label="Access variable R|/|"]; + 123 [label="Function call: R|/|.R|FakeOverride|()"]; + 124 [label="Variable declaration: lval element: R|T|"]; + subgraph cluster_33 { + color=blue + 125 [label="Enter when"]; + subgraph cluster_34 { + color=blue + 126 [label="Enter when branch condition "]; + 127 [label="Access variable R|/element|"]; + 128 [label="Type operator: element is T"]; + 129 [label="Exit when branch condition"]; + } + 130 [label="Synthetic else branch"]; + 131 [label="Enter when branch result"]; + subgraph cluster_35 { + color=blue + 132 [label="Enter block"]; + 133 [label="Access variable R|/element|"]; + 134 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; + 135 [label="Stub" style="filled" fillcolor=gray]; + 136 [label="Exit block" style="filled" fillcolor=gray]; + } + 137 [label="Exit when branch result" style="filled" fillcolor=gray]; + 138 [label="Exit when"]; + } + 139 [label="Exit block"]; + } + 140 [label="Exit loop block"]; + } + 141 [label="Exit whileloop"]; + } + 142 [label="Const: Null(null)"]; + 143 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; + 144 [label="Stub" style="filled" fillcolor=gray]; + 145 [label="Exit block" style="filled" fillcolor=gray]; + } + 146 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; + } + 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; - 112 -> {114 113}; - 113 -> {121}; + 112 -> {113}; + 113 -> {114}; 114 -> {115}; 115 -> {116}; 116 -> {117}; - 117 -> {129}; - 117 -> {118} [style=dotted]; - 118 -> {119} [style=dotted]; - 119 -> {120} [style=dotted]; - 120 -> {121} [style=dotted]; + 117 -> {118}; + 118 -> {119}; + 119 -> {141 120}; + 120 -> {121}; 121 -> {122}; 122 -> {123}; - 123 -> {99}; + 123 -> {124}; 124 -> {125}; 125 -> {126}; - 126 -> {129}; - 126 -> {127} [style=dotted]; - 127 -> {128} [style=dotted]; - 128 -> {129} [style=dotted]; + 126 -> {127}; + 127 -> {128}; + 128 -> {129}; + 129 -> {131 130}; + 130 -> {138}; + 131 -> {132}; + 132 -> {133}; + 133 -> {134}; + 134 -> {146}; + 134 -> {135} [style=dotted]; + 135 -> {136} [style=dotted]; + 136 -> {137} [style=dotted]; + 137 -> {138} [style=dotted]; + 138 -> {139}; + 139 -> {140}; + 140 -> {116}; + 141 -> {142}; + 142 -> {143}; + 143 -> {146}; + 143 -> {144} [style=dotted]; + 144 -> {145} [style=dotted]; + 145 -> {146} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.kt b/compiler/fir/resolve/testData/resolve/cfg/complex.kt index ba27b36f120..b55b221a89c 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.kt +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.kt @@ -4,7 +4,7 @@ fun fetchPluginReleaseDate(pluginId: PluginId, version: String, channel: String? val pluginDTOs: Array = try { HttpRequests.request(url).connect { - GsonBuilder().create().fromJson(it.inputStream.reader(), Array::class.java) + GsonBuilder().create().fromJson(it.inputStream.reader(), Array::class.java) } } catch (ioException: JsonIOException) { throw IOException(ioException) diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.txt b/compiler/fir/resolve/testData/resolve/cfg/complex.txt index 5d52e309544..2d7b512be1f 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.txt @@ -2,8 +2,8 @@ FILE: complex.kt @R|kotlin/jvm/Throws|((#), (#)) public final fun fetchPluginReleaseDate(pluginId: R|class error: Symbol not found, for `PluginId`|, version: R|kotlin/String|, channel: R|kotlin/String?|): R|class error: Symbol not found, for `LocalDate?`| { lval url: R|kotlin/String| = (String(https://plugins.jetbrains.com/api/plugins/), R|/pluginId|.#, String(/updates?version=), R|/version|) lval pluginDTOs: R|kotlin/Array| = try { - #.#(R|/url|).#( = connect@fun .(): { - GsonBuilder#().create#().fromJson#(it#.inputStream#.reader#(), (Array#()).java#) + #.#(R|/url|).#( = connect@fun .(): { + #().#().#(#.#.#(), (#()).#) } ) } diff --git a/compiler/fir/resolve/testData/resolve/samConversions/genericSam.txt b/compiler/fir/resolve/testData/resolve/samConversions/genericSam.txt index 5fe13a5a916..1906e6b483d 100644 --- a/compiler/fir/resolve/testData/resolve/samConversions/genericSam.txt +++ b/compiler/fir/resolve/testData/resolve/samConversions/genericSam.txt @@ -8,8 +8,8 @@ FILE: main.kt R|/x|.R|kotlin/Number.toInt|().R|kotlin/Any.toString|() } ) - Q|JavaUsage|.#( = foo2@fun .(x: R|kotlin/Int|): { - x#.toString#() + Q|JavaUsage|.#( = foo2@fun .(x: R|kotlin/Int|): R|kotlin/String| { + R|/x|.R|kotlin/Any.toString|() } ) Q|JavaUsage|.R|/JavaUsage.foo3||, R|ft|>(foo3@fun (x: R|ft|): R|kotlin/Unit| { diff --git a/compiler/fir/resolve/testData/resolve/samConversions/kotlinSam.txt b/compiler/fir/resolve/testData/resolve/samConversions/kotlinSam.txt index 4d95e7aab84..f42d744e935 100644 --- a/compiler/fir/resolve/testData/resolve/samConversions/kotlinSam.txt +++ b/compiler/fir/resolve/testData/resolve/samConversions/kotlinSam.txt @@ -38,13 +38,13 @@ FILE: kotlinSam.kt } ) R|/foo1|(R|/f|) - #( = foo2@fun .(x: ): { - >(x#, Int(1)) + #( = foo2@fun .(x: ): R|kotlin/Boolean| { + >(R|/x|, Int(1)) } ) #(R|/f|) - #( = foo3@fun .(x: ): { - >(x#, Int(1)) + #( = foo3@fun .(x: ): R|kotlin/Boolean| { + >(R|/x|, Int(1)) } ) #(R|/f|) diff --git a/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.kt b/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.kt index 56d5ac901be..cdce25c7845 100644 --- a/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.kt +++ b/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.kt @@ -23,7 +23,7 @@ fun main() { x > 1 } - JavaUsage.foo({ it > 1 }) + JavaUsage.foo({ it > 1 }) val x = { x: Int -> x > 1 } diff --git a/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.txt b/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.txt index be3a9b60091..1177e9563f9 100644 --- a/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.txt +++ b/compiler/fir/resolve/testData/resolve/samConversions/notSamBecauseOfSupertype.txt @@ -2,12 +2,12 @@ FILE: main.kt public final fun foo(m: R|MyRunnable|): R|kotlin/Unit| { } public final fun main(): R|kotlin/Unit| { - Q|JavaUsage|.#( = foo@fun .(x: ): { - >(x#, Int(1)) + Q|JavaUsage|.#( = foo@fun .(x: ): R|kotlin/Boolean| { + >(R|/x|, Int(1)) } ) - Q|JavaUsage|.#(foo@fun .(): { - >(it#, Int(1)) + Q|JavaUsage|.#(foo@fun .(): R|kotlin/Boolean| { + >(#, Int(1)) } ) lval x: R|kotlin/Function1| = fun (x: R|kotlin/Int|): R|kotlin/Boolean| { diff --git a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/companions.txt b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/companions.txt index f80cf71ea3d..f46a2d2059a 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/companions.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/companions.txt @@ -52,11 +52,11 @@ FILE: main.kt public final fun main(): R|kotlin/Unit| { R|/foo1|(Q|KotlinClass|::R|/KotlinClass.Companion.baz|) R|/foo2|(Q|KotlinClass|::R|/KotlinClass.baz|) - #(Q|KotlinClass|::baz#) + #(Q|KotlinClass|::R|/KotlinClass.baz|) R|/foo1|(Q|KotlinClass|::R|/JavaClass.bar|) R|/foo2|(Q|KotlinClass|::R|/JavaClass.bar|) - #(Q|KotlinClass|::bar#) + #(Q|KotlinClass|::R|/JavaClass.bar|) R|/foo1|(Q|KotlinClass2|::R|/JavaClass.bar|) - #(Q|KotlinClass2|::bar#) + #(Q|KotlinClass2|::R|/JavaClass.bar|) R|/foo3|(Q|KotlinClass2|::R|/JavaClass.bar|) } diff --git a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.txt b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.txt index 66826fcf1d3..8a3707ffe9e 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/fromBasicDiagnosticTests/resolveCallableReferencesAfterAllSimpleArguments.txt @@ -10,6 +10,6 @@ FILE: resolveCallableReferencesAfterAllSimpleArguments.kt public final fun baz(e: R|T|, f: R|kotlin/Function1|): R|kotlin/Unit| { } public final fun test(a: R|A|, b: R|B|): R|kotlin/Unit| { - #(R|/a|, ::fooB#) - #(::fooB#, R|/a|) + #(R|/a|, ::R|/fooB|) + #(::R|/fooB|, R|/a|) } diff --git a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/implicitTypes.txt b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/implicitTypes.txt index 5f6e2cb1f70..2de4452dbb3 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/implicitTypes.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/implicitTypes.txt @@ -9,7 +9,7 @@ FILE: implicitTypes.kt ^bar Int(1) } public final fun loop1(): { - ^loop1 #(::loop2#) + ^loop1 #(::R|/loop2|) } public final fun loop2(): { ^loop2 R?C|/loop1|() diff --git a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/javaStatic.txt b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/javaStatic.txt index b5783d084c1..4e777c388a8 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/javaStatic.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/callableReferences/javaStatic.txt @@ -10,5 +10,5 @@ FILE: main.kt public final fun main(): R|kotlin/Unit| { R|/foo1|(Q|JavaClass|::R|/JavaClass.bar|) R|/foo2|(Q|JavaClass|::R|/JavaClass.bar|) - #(Q|JavaClass|::bar#) + #(Q|JavaClass|::R|/JavaClass.bar|) } diff --git a/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt b/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt index 5a8d9accb41..2bbf6ac6c4c 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt @@ -6,8 +6,8 @@ FILE: test.kt ) lval otherResult: R|kotlin/String| = R|/map|.R|FakeOverride|(String(key), String(value)) lval anotherResult: = R|/map|.#(String(key), String(value)) - R|/map|.#( = forEach@fun .(key: , value: ): { - println#((key#, String(: ), value#)) + R|/map|.#( = forEach@fun .(key: , value: ): R|kotlin/Unit| { + R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) } ) R|/map|.R|kotlin/collections/forEach|( = forEach@fun (: R|kotlin/collections/Map.Entry|): R|kotlin/Unit| { @@ -24,8 +24,8 @@ FILE: test.kt ) lval otherResult: R|kotlin/String| = R|/map|.R|FakeOverride|(String(key), String(value)) lval anotherResult: = R|/map|.#(String(key), String(value)) - R|/map|.#( = forEach@fun .(key: , value: ): { - println#((key#, String(: ), value#)) + R|/map|.#( = forEach@fun .(key: , value: ): R|kotlin/Unit| { + R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) } ) R|/map|.R|kotlin/collections/forEach|( = forEach@fun (: R|kotlin/collections/Map.Entry|): R|kotlin/Unit| { diff --git a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.txt b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.txt index 150e2aa3838..d63dbcde3a5 100644 --- a/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samByProjectedType.fir.txt @@ -3,7 +3,7 @@ FILE fqName: fileName:/samByProjectedType.kt BLOCK_BODY ERROR_CALL 'Unresolved reference: #' type=IrErrorType FUN_EXPR type=IrErrorType origin=LAMBDA - FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (x:kotlin.Any) returnType:IrErrorType + FUN LOCAL_FUNCTION_FOR_LAMBDA name: visibility:local modality:FINAL <> (x:kotlin.Any) returnType:kotlin.Any VALUE_PARAMETER name:x index:0 type:kotlin.Any BLOCK_BODY - ERROR_CALL 'Unresolved reference: x#' type=IrErrorType + GET_VAR 'x: kotlin.Any declared in .test1.' type=kotlin.Any origin=null diff --git a/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt index b5df05b58fb..f457d98a1bb 100644 --- a/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt +++ b/compiler/testData/ir/irText/expressions/sam/samConstructors.fir.txt @@ -29,5 +29,5 @@ FILE fqName: fileName:/samConstructors.kt VALUE_PARAMETER name:a index:0 type:IrErrorType VALUE_PARAMETER name:b index:1 type:IrErrorType BLOCK_BODY - ERROR_CALL 'Unresolved reference: minus#' type=IrErrorType - ERROR_CALL 'Unresolved reference: b#' type=IrErrorType + ERROR_CALL 'Unresolved reference: #' type=IrErrorType + GET_VAR 'b: IrErrorType declared in .test4.' type=IrErrorType origin=null