diff --git a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt index fedddfea3ca..c352a61a7d9 100644 --- a/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt +++ b/compiler/fir/psi2fir/src/org/jetbrains/kotlin/fir/builder/BaseFirBuilder.kt @@ -35,6 +35,7 @@ import org.jetbrains.kotlin.lexer.KtTokens.OPEN_QUOTE import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.KtClassOrObject +import org.jetbrains.kotlin.psi.KtStringTemplateEntryWithExpression import org.jetbrains.kotlin.psi.KtStringTemplateExpression import org.jetbrains.kotlin.psi.KtUnaryExpression import org.jetbrains.kotlin.resolve.constants.evaluate.* @@ -289,7 +290,12 @@ abstract class BaseFirBuilder(val session: FirSession, val context: Context = } SHORT_STRING_TEMPLATE_ENTRY, LONG_STRING_TEMPLATE_ENTRY -> { hasExpressions = true - entry.convertTemplateEntry("Incorrect template argument") + val firExpression = entry.convertTemplateEntry("Incorrect template argument") + val source = firExpression.source + FirFunctionCallImpl(source).apply { + explicitReceiver = firExpression + calleeReference = FirSimpleNamedReference(source, Name.identifier("toString"), candidateSymbol = null) + } } else -> { hasExpressions = true diff --git a/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt b/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt index 70e667ff056..d53d208f667 100644 --- a/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt +++ b/compiler/fir/psi2fir/testData/rawBuilder/expressions/for.txt @@ -54,7 +54,7 @@ FILE: for.kt lval : = R|/|.next#() lval x: = R|/|.component1() lval y: = R|/|.component2() - println#((String(x = ), x#, String( y = ), y#)) + println#((String(x = ), x#.toString#(), String( y = ), y#.toString#())) } } diff --git a/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.kt b/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.kt new file mode 100644 index 00000000000..a863ad03614 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.kt @@ -0,0 +1,7 @@ +class A + +fun foo(s: String) {} + +fun test(a: A) { + foo("$a") +} \ No newline at end of file diff --git a/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.txt b/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.txt new file mode 100644 index 00000000000..c4fd97009c8 --- /dev/null +++ b/compiler/fir/resolve/testData/resolve/arguments/stringTemplates.txt @@ -0,0 +1,12 @@ +FILE: stringTemplates.kt + public final class A : R|kotlin/Any| { + public constructor(): R|A| { + super() + } + + } + public final fun foo(s: R|kotlin/String|): R|kotlin/Unit| { + } + public final fun test(a: R|A|): R|kotlin/Unit| { + R|/foo|(R|/a|.R|kotlin/Any.toString|()) + } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.dot b/compiler/fir/resolve/testData/resolve/cfg/complex.dot index 7712ded3178..ae18582bd96 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.dot +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.dot @@ -9,77 +9,79 @@ digraph complex_kt { 1 [label="Const: String(https://plugins.jetbrains.com/api/plugins/)"]; 2 [label="Access variable R|/pluginId|"]; 3 [label="Access variable #"]; - 4 [label="Const: String(/updates?version=)"]; - 5 [label="Access variable R|/version|"]; - 6 [label="Variable declaration: lval url: R|kotlin/String|"]; + 4 [label="Function call: R|/pluginId|.#.R|kotlin/toString|()"]; + 5 [label="Const: String(/updates?version=)"]; + 6 [label="Access variable R|/version|"]; + 7 [label="Function call: R|/version|.R|kotlin/Any.toString|()"]; + 8 [label="Variable declaration: lval url: R|kotlin/String|"]; subgraph cluster_1 { color=blue - 7 [label="Try expression enter"]; + 9 [label="Try expression enter"]; subgraph cluster_2 { color=blue - 8 [label="Try main block enter"]; + 10 [label="Try main block enter"]; subgraph cluster_3 { color=blue - 9 [label="Enter block"]; - 10 [label="Access variable #"]; - 11 [label="Access variable R|/url|"]; - 12 [label="Access variable R|/url|"]; + 11 [label="Enter block"]; + 12 [label="Access variable #"]; 13 [label="Access variable R|/url|"]; - 14 [label="Function call: #.#(R|/url|)"]; - 15 [label="Function call: #.#(R|/url|).#( = connect@fun (): { + 14 [label="Access variable R|/url|"]; + 15 [label="Access variable R|/url|"]; + 16 [label="Function call: #.#(R|/url|)"]; + 17 [label="Function call: #.#(R|/url|).#( = connect@fun (): { #().#().#(#.#.#(), (#()).#) } )"]; - 16 [label="Exit block"]; + 18 [label="Exit block"]; } - 17 [label="Try main block exit"]; + 19 [label="Try main block exit"]; } subgraph cluster_4 { color=blue - 18 [label="Catch enter"]; + 20 [label="Catch enter"]; subgraph cluster_5 { color=blue - 19 [label="Enter block"]; - 20 [label="Const: String(Can't parse json response)"]; - 21 [label="Access variable R|/syntaxException|"]; + 21 [label="Enter block"]; 22 [label="Const: String(Can't parse json response)"]; 23 [label="Access variable R|/syntaxException|"]; 24 [label="Const: String(Can't parse json response)"]; 25 [label="Access variable R|/syntaxException|"]; - 26 [label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; - 27 [label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; - 28 [label="Stub" style="filled" fillcolor=gray]; - 29 [label="Exit block" style="filled" fillcolor=gray]; + 26 [label="Const: String(Can't parse json response)"]; + 27 [label="Access variable R|/syntaxException|"]; + 28 [label="Function call: #(String(Can't parse json response), R|/syntaxException|)"]; + 29 [label="Throw: throw #(String(Can't parse json response), R|/syntaxException|)"]; + 30 [label="Stub" style="filled" fillcolor=gray]; + 31 [label="Exit block" style="filled" fillcolor=gray]; } - 30 [label="Catch exit" style="filled" fillcolor=gray]; + 32 [label="Catch exit" style="filled" fillcolor=gray]; } subgraph cluster_6 { color=blue - 31 [label="Catch enter"]; + 33 [label="Catch enter"]; subgraph cluster_7 { color=blue - 32 [label="Enter block"]; - 33 [label="Access variable R|/ioException|"]; - 34 [label="Access variable R|/ioException|"]; + 34 [label="Enter block"]; 35 [label="Access variable R|/ioException|"]; - 36 [label="Function call: #(R|/ioException|)"]; - 37 [label="Throw: throw #(R|/ioException|)"]; - 38 [label="Stub" style="filled" fillcolor=gray]; - 39 [label="Exit block" style="filled" fillcolor=gray]; + 36 [label="Access variable R|/ioException|"]; + 37 [label="Access variable R|/ioException|"]; + 38 [label="Function call: #(R|/ioException|)"]; + 39 [label="Throw: throw #(R|/ioException|)"]; + 40 [label="Stub" style="filled" fillcolor=gray]; + 41 [label="Exit block" style="filled" fillcolor=gray]; } - 40 [label="Catch exit" style="filled" fillcolor=gray]; + 42 [label="Catch exit" style="filled" fillcolor=gray]; } - 41 [label="Try expression exit"]; + 43 [label="Try expression exit"]; } - 42 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; - 43 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; + 44 [label="Variable declaration: lval pluginDTOs: R|kotlin/Array|"]; + 45 [label="Exit function fetchPluginReleaseDate" style="filled" fillcolor=red]; } subgraph cluster_8 { color=blue - 44 [label="Enter annotation"]; - 45 [label="Access variable #"]; - 46 [label="Access variable #"]; - 47 [label="Exit annotation"]; + 46 [label="Enter annotation"]; + 47 [label="Access variable #"]; + 48 [label="Access variable #"]; + 49 [label="Exit annotation"]; } 0 -> {1}; @@ -90,66 +92,66 @@ digraph complex_kt { 5 -> {6}; 6 -> {7}; 7 -> {8}; - 8 -> {43 31 18 9}; + 8 -> {9}; 9 -> {10}; - 10 -> {11}; + 10 -> {45 33 20 11}; 11 -> {12}; 12 -> {13}; 13 -> {14}; 14 -> {15}; 15 -> {16}; 16 -> {17}; - 17 -> {41}; - 18 -> {43 19}; - 19 -> {20}; - 20 -> {21}; + 17 -> {18}; + 18 -> {19}; + 19 -> {43}; + 20 -> {45 21}; 21 -> {22}; 22 -> {23}; 23 -> {24}; 24 -> {25}; 25 -> {26}; 26 -> {27}; - 27 -> {43}; - 27 -> {28} [style=dotted]; - 28 -> {29} [style=dotted]; + 27 -> {28}; + 28 -> {29}; + 29 -> {45}; 29 -> {30} [style=dotted]; - 30 -> {41} [style=dotted]; - 31 -> {43 32}; - 32 -> {33}; - 33 -> {34}; + 30 -> {31} [style=dotted]; + 31 -> {32} [style=dotted]; + 32 -> {43} [style=dotted]; + 33 -> {45 34}; 34 -> {35}; 35 -> {36}; 36 -> {37}; - 37 -> {43}; - 37 -> {38} [style=dotted]; - 38 -> {39} [style=dotted]; + 37 -> {38}; + 38 -> {39}; + 39 -> {45}; 39 -> {40} [style=dotted]; 40 -> {41} [style=dotted]; - 41 -> {42}; - 42 -> {43}; + 41 -> {42} [style=dotted]; + 42 -> {43} [style=dotted]; 43 -> {44}; 44 -> {45}; 45 -> {46}; 46 -> {47}; + 47 -> {48}; + 48 -> {49}; subgraph cluster_9 { color=red - 48 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; - 49 [label="Function call: #()"]; - 50 [label="Function call: #().#()"]; - 51 [label="Access variable #"]; - 52 [label="Access variable #"]; - 53 [label="Function call: #.#.#()"]; - 54 [label="Function call: #()"]; - 55 [label="Access variable #"]; - 56 [label="Access variable #"]; + 50 [label="Enter function anonymousFunction" style="filled" fillcolor=red]; + 51 [label="Function call: #()"]; + 52 [label="Function call: #().#()"]; + 53 [label="Access variable #"]; + 54 [label="Access variable #"]; + 55 [label="Function call: #.#.#()"]; + 56 [label="Function call: #()"]; 57 [label="Access variable #"]; - 58 [label="Function call: #().#().#(#.#.#(), (#()).#)"]; - 59 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; + 58 [label="Access variable #"]; + 59 [label="Access variable #"]; + 60 [label="Function call: #().#().#(#.#.#(), (#()).#)"]; + 61 [label="Exit function anonymousFunction" style="filled" fillcolor=red]; } - 48 -> {49}; - 49 -> {50}; 50 -> {51}; 51 -> {52}; 52 -> {53}; @@ -159,96 +161,98 @@ digraph complex_kt { 56 -> {57}; 57 -> {58}; 58 -> {59}; + 59 -> {60}; + 60 -> {61}; subgraph cluster_10 { color=red - 60 [label="Enter function close" style="filled" fillcolor=red]; - 61 [label="Exit function close" style="filled" fillcolor=red]; + 62 [label="Enter function close" style="filled" fillcolor=red]; + 63 [label="Exit function close" style="filled" fillcolor=red]; } - 60 -> {61}; + 62 -> {63}; subgraph cluster_11 { color=red - 62 [label="Enter function closeFinally" style="filled" fillcolor=red]; + 64 [label="Enter function closeFinally" style="filled" fillcolor=red]; subgraph cluster_12 { color=blue - 63 [label="Enter when"]; + 65 [label="Enter when"]; subgraph cluster_13 { color=blue - 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"]; + 66 [label="Enter when branch condition "]; + 67 [label="Access variable this@R|/closeFinally|"]; + 68 [label="Const: Null(null)"]; + 69 [label="Operator =="]; + 70 [label="Exit when branch condition"]; } subgraph cluster_14 { color=blue - 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"]; + 71 [label="Enter when branch condition "]; + 72 [label="Access variable R|/cause|"]; + 73 [label="Const: Null(null)"]; + 74 [label="Operator =="]; + 75 [label="Exit when branch condition"]; } subgraph cluster_15 { color=blue - 74 [label="Enter when branch condition else"]; - 75 [label="Exit when branch condition"]; + 76 [label="Enter when branch condition else"]; + 77 [label="Exit when branch condition"]; } - 76 [label="Enter when branch result"]; + 78 [label="Enter when branch result"]; subgraph cluster_16 { color=blue - 77 [label="Enter block"]; + 79 [label="Enter block"]; subgraph cluster_17 { color=blue - 78 [label="Try expression enter"]; + 80 [label="Try expression enter"]; subgraph cluster_18 { color=blue - 79 [label="Try main block enter"]; + 81 [label="Try main block enter"]; subgraph cluster_19 { color=blue - 80 [label="Enter block"]; - 81 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; - 82 [label="Exit block"]; + 82 [label="Enter block"]; + 83 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; + 84 [label="Exit block"]; } - 83 [label="Try main block exit"]; + 85 [label="Try main block exit"]; } subgraph cluster_20 { color=blue - 84 [label="Catch enter"]; + 86 [label="Catch enter"]; subgraph cluster_21 { 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"]; + 87 [label="Enter block"]; + 88 [label="Access variable R|/cause|"]; + 89 [label="Access variable R|/closeException|"]; + 90 [label="Function call: R|/cause|.R|kotlin/addSuppressed|(R|/closeException|)"]; + 91 [label="Exit block"]; } - 90 [label="Catch exit"]; + 92 [label="Catch exit"]; } - 91 [label="Try expression exit"]; + 93 [label="Try expression exit"]; } - 92 [label="Exit block"]; + 94 [label="Exit block"]; } - 93 [label="Exit when branch result"]; - 94 [label="Enter when branch result"]; + 95 [label="Exit when branch result"]; + 96 [label="Enter when branch result"]; subgraph cluster_22 { color=blue - 95 [label="Enter block"]; - 96 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; - 97 [label="Exit block"]; + 97 [label="Enter block"]; + 98 [label="Function call: this@R|/AutoCloseable|.R|/AutoCloseable.close|()"]; + 99 [label="Exit block"]; } - 98 [label="Exit when branch result"]; - 99 [label="Enter when branch result"]; + 100 [label="Exit when branch result"]; + 101 [label="Enter when branch result"]; subgraph cluster_23 { color=blue - 100 [label="Enter block"]; - 101 [label="Exit block"]; + 102 [label="Enter block"]; + 103 [label="Exit block"]; } - 102 [label="Exit when branch result"]; - 103 [label="Exit when"]; + 104 [label="Exit when branch result"]; + 105 [label="Exit when"]; } - 104 [label="Jump: ^closeFinally when () { + 106 [label="Jump: ^closeFinally when () { ==(this@R|/closeFinally|, Null(null)) -> { } ==(R|/cause|, Null(null)) -> { @@ -265,120 +269,118 @@ digraph complex_kt { } } "]; - 105 [label="Stub" style="filled" fillcolor=gray]; - 106 [label="Exit function closeFinally" style="filled" fillcolor=red]; + 107 [label="Stub" style="filled" fillcolor=gray]; + 108 [label="Exit function closeFinally" style="filled" fillcolor=red]; } - 62 -> {63}; - 63 -> {64}; 64 -> {65}; 65 -> {66}; 66 -> {67}; 67 -> {68}; - 68 -> {99 69}; + 68 -> {69}; 69 -> {70}; - 70 -> {71}; + 70 -> {101 71}; 71 -> {72}; 72 -> {73}; - 73 -> {94 74}; + 73 -> {74}; 74 -> {75}; - 75 -> {76}; + 75 -> {96 76}; 76 -> {77}; 77 -> {78}; 78 -> {79}; - 79 -> {106 84 80}; + 79 -> {80}; 80 -> {81}; - 81 -> {82}; + 81 -> {108 86 82}; 82 -> {83}; - 83 -> {91}; - 84 -> {106 85}; - 85 -> {86}; - 86 -> {87}; + 83 -> {84}; + 84 -> {85}; + 85 -> {93}; + 86 -> {108 87}; 87 -> {88}; 88 -> {89}; 89 -> {90}; 90 -> {91}; 91 -> {92}; 92 -> {93}; - 93 -> {103}; + 93 -> {94}; 94 -> {95}; - 95 -> {96}; + 95 -> {105}; 96 -> {97}; 97 -> {98}; - 98 -> {103}; + 98 -> {99}; 99 -> {100}; - 100 -> {101}; + 100 -> {105}; 101 -> {102}; 102 -> {103}; 103 -> {104}; - 104 -> {106}; - 104 -> {105} [style=dotted]; - 105 -> {106} [style=dotted]; + 104 -> {105}; + 105 -> {106}; + 106 -> {108}; + 106 -> {107} [style=dotted]; + 107 -> {108} [style=dotted]; subgraph cluster_24 { color=red - 107 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; - 108 [label="Access variable this@R|/firstIsInstanceOrNull|"]; - 109 [label="Variable declaration: lval : R|kotlin/sequences/Sequence<*>|"]; - 110 [label="Access variable R|/|"]; - 111 [label="Function call: R|/|.R|kotlin/sequences/Sequence.iterator|()"]; - 112 [label="Variable declaration: lval : R|kotlin/collections/Iterator|"]; + 109 [label="Enter function firstIsInstanceOrNull" style="filled" fillcolor=red]; + 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_25 { color=blue - 113 [label="Enter while loop"]; + 115 [label="Enter while loop"]; subgraph cluster_26 { color=blue - 114 [label="Enter loop condition"]; - 115 [label="Access variable R|/|"]; - 116 [label="Function call: R|/|.R|kotlin/collections/Iterator.hasNext|()"]; - 117 [label="Exit loop condition"]; + 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_27 { color=blue - 118 [label="Enter loop block"]; + 120 [label="Enter loop block"]; subgraph cluster_28 { color=blue - 119 [label="Enter block"]; - 120 [label="Access variable R|/|"]; - 121 [label="Function call: R|/|.R|FakeOverride|()"]; - 122 [label="Variable declaration: lval element: R|T|"]; + 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_29 { color=blue - 123 [label="Enter when"]; + 125 [label="Enter when"]; subgraph cluster_30 { color=blue - 124 [label="Enter when branch condition "]; - 125 [label="Access variable R|/element|"]; - 126 [label="Type operator: element is T"]; - 127 [label="Exit when branch condition"]; + 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"]; } - 128 [label="Synthetic else branch"]; - 129 [label="Enter when branch result"]; + 130 [label="Synthetic else branch"]; + 131 [label="Enter when branch result"]; subgraph cluster_31 { color=blue - 130 [label="Enter block"]; - 131 [label="Access variable R|/element|"]; - 132 [label="Jump: ^firstIsInstanceOrNull R|/element|"]; - 133 [label="Stub" style="filled" fillcolor=gray]; - 134 [label="Exit block" style="filled" fillcolor=gray]; + 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]; } - 135 [label="Exit when branch result" style="filled" fillcolor=gray]; - 136 [label="Exit when"]; + 137 [label="Exit when branch result" style="filled" fillcolor=gray]; + 138 [label="Exit when"]; } - 137 [label="Exit block"]; + 139 [label="Exit block"]; } - 138 [label="Exit loop block"]; + 140 [label="Exit loop block"]; } - 139 [label="Exit whileloop"]; + 141 [label="Exit whileloop"]; } - 140 [label="Const: Null(null)"]; - 141 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; - 142 [label="Stub" style="filled" fillcolor=gray]; - 143 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; + 142 [label="Const: Null(null)"]; + 143 [label="Jump: ^firstIsInstanceOrNull Null(null)"]; + 144 [label="Stub" style="filled" fillcolor=gray]; + 145 [label="Exit function firstIsInstanceOrNull" style="filled" fillcolor=red]; } - 107 -> {108}; - 108 -> {109}; 109 -> {110}; 110 -> {111}; 111 -> {112}; @@ -387,9 +389,9 @@ digraph complex_kt { 114 -> {115}; 115 -> {116}; 116 -> {117}; - 117 -> {139 118}; + 117 -> {118}; 118 -> {119}; - 119 -> {120}; + 119 -> {141 120}; 120 -> {121}; 121 -> {122}; 122 -> {123}; @@ -397,23 +399,25 @@ digraph complex_kt { 124 -> {125}; 125 -> {126}; 126 -> {127}; - 127 -> {129 128}; - 128 -> {136}; - 129 -> {130}; - 130 -> {131}; + 127 -> {128}; + 128 -> {129}; + 129 -> {131 130}; + 130 -> {138}; 131 -> {132}; - 132 -> {143}; - 132 -> {133} [style=dotted]; - 133 -> {134} [style=dotted]; + 132 -> {133}; + 133 -> {134}; + 134 -> {145}; 134 -> {135} [style=dotted]; 135 -> {136} [style=dotted]; - 136 -> {137}; - 137 -> {138}; - 138 -> {114}; + 136 -> {137} [style=dotted]; + 137 -> {138} [style=dotted]; + 138 -> {139}; 139 -> {140}; - 140 -> {141}; - 141 -> {143}; - 141 -> {142} [style=dotted]; - 142 -> {143} [style=dotted]; + 140 -> {116}; + 141 -> {142}; + 142 -> {143}; + 143 -> {145}; + 143 -> {144} [style=dotted]; + 144 -> {145} [style=dotted]; } diff --git a/compiler/fir/resolve/testData/resolve/cfg/complex.txt b/compiler/fir/resolve/testData/resolve/cfg/complex.txt index 5259aef435a..3d2de763451 100644 --- a/compiler/fir/resolve/testData/resolve/cfg/complex.txt +++ b/compiler/fir/resolve/testData/resolve/cfg/complex.txt @@ -1,6 +1,6 @@ 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 url: R|kotlin/String| = (String(https://plugins.jetbrains.com/api/plugins/), R|/pluginId|.#.R|kotlin/toString|(), String(/updates?version=), R|/version|.R|kotlin/Any.toString|()) lval pluginDTOs: R|kotlin/Array| = try { #.#(R|/url|).#( = connect@fun (): { #().#().#(#.#.#(), (#()).#) diff --git a/compiler/fir/resolve/testData/resolve/expresssions/lambda.txt b/compiler/fir/resolve/testData/resolve/expresssions/lambda.txt index ec7be20d201..923c762b823 100644 --- a/compiler/fir/resolve/testData/resolve/expresssions/lambda.txt +++ b/compiler/fir/resolve/testData/resolve/expresssions/lambda.txt @@ -17,11 +17,11 @@ FILE: lambda.kt } ) R|/itIs|( = itIs@fun (it: R|kotlin/String|): R|kotlin/String| { - (String(this is ), R|/it|, String( test)) + (String(this is ), R|/it|.R|kotlin/Any.toString|(), String( test)) } ) R|/multipleArgs|( = multipleArgs@fun (a: R|kotlin/String|, b: R|kotlin/String|): R|kotlin/String| { - (String(This is test of ), R|/a|, String(, ), R|/b|) + (String(This is test of ), R|/a|.R|kotlin/Any.toString|(), String(, ), R|/b|.R|kotlin/Any.toString|()) } ) } 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 c27ac926ce2..edb5b9ce067 100644 --- a/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt +++ b/compiler/fir/resolve/testData/resolve/stdlib/j+k/MyMap.txt @@ -7,13 +7,13 @@ 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: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| { - R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) + R|kotlin/io/println|((R|/key|.R|kotlin/toString|(), String(: ), R|/value|.R|kotlin/toString|())) } ) R|/map|.R|kotlin/collections/forEach|( = forEach@fun (: R|kotlin/collections/Map.Entry|): R|kotlin/Unit| { lval key: R|kotlin/String| = R|/|.R|kotlin/collections/component1|() lval value: R|kotlin/String| = R|/|.R|kotlin/collections/component2|() - R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) + R|kotlin/io/println|((R|/key|.R|kotlin/Any.toString|(), String(: ), R|/value|.R|kotlin/Any.toString|())) } ) } @@ -25,13 +25,13 @@ 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: R|class error: No type for parameter|, value: R|class error: No type for parameter|): R|kotlin/Unit| { - R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) + R|kotlin/io/println|((R|/key|.R|kotlin/toString|(), String(: ), R|/value|.R|kotlin/toString|())) } ) R|/map|.R|kotlin/collections/forEach|( = forEach@fun (: R|kotlin/collections/Map.Entry|): R|kotlin/Unit| { lval key: R|kotlin/String| = R|/|.R|kotlin/collections/component1|() lval value: R|kotlin/String| = R|/|.R|kotlin/collections/component2|() - R|kotlin/io/println|((R|/key|, String(: ), R|/value|)) + R|kotlin/io/println|((R|/key|.R|kotlin/Any.toString|(), String(: ), R|/value|.R|kotlin/Any.toString|())) } ) } diff --git a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java index 960be0ac189..bac807efacf 100644 --- a/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java +++ b/compiler/fir/resolve/tests/org/jetbrains/kotlin/fir/FirDiagnosticsTestGenerated.java @@ -295,6 +295,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest { runTest("compiler/fir/resolve/testData/resolve/arguments/simple.kt"); } + @TestMetadata("stringTemplates.kt") + public void testStringTemplates() throws Exception { + runTest("compiler/fir/resolve/testData/resolve/arguments/stringTemplates.kt"); + } + @TestMetadata("tryInLambda.kt") public void testTryInLambda() throws Exception { runTest("compiler/fir/resolve/testData/resolve/arguments/tryInLambda.kt"); diff --git a/compiler/testData/codegen/box/primitiveTypes/kt2794.kt b/compiler/testData/codegen/box/primitiveTypes/kt2794.kt index d0f91418772..bd6c80dced5 100644 --- a/compiler/testData/codegen/box/primitiveTypes/kt2794.kt +++ b/compiler/testData/codegen/box/primitiveTypes/kt2794.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun box () : String { val b = 4.toByte() val s = 5.toShort() diff --git a/compiler/testData/codegen/box/strings/kt3652.kt b/compiler/testData/codegen/box/strings/kt3652.kt index acd6401e056..f9e678089b8 100644 --- a/compiler/testData/codegen/box/strings/kt3652.kt +++ b/compiler/testData/codegen/box/strings/kt3652.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun box(): String { var a = 'a' diff --git a/compiler/testData/codegen/box/strings/kt881.kt b/compiler/testData/codegen/box/strings/kt881.kt index 182514b3775..ba9911d887e 100644 --- a/compiler/testData/codegen/box/strings/kt881.kt +++ b/compiler/testData/codegen/box/strings/kt881.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun box() : String { val b = 1+1 if ("$b" != "2") return "fail" diff --git a/compiler/testData/codegen/box/strings/singleConcatNullable.kt b/compiler/testData/codegen/box/strings/singleConcatNullable.kt index a0cf099d9e1..e714a8fc7a2 100644 --- a/compiler/testData/codegen/box/strings/singleConcatNullable.kt +++ b/compiler/testData/codegen/box/strings/singleConcatNullable.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun f(s: String?): String { return "$s" } @@ -6,4 +5,4 @@ fun f(s: String?): String { fun box(): String { if (f(null) != "null") return "Fail" return "OK" -} \ No newline at end of file +} diff --git a/compiler/testData/codegen/box/when/typeDisjunction.kt b/compiler/testData/codegen/box/when/typeDisjunction.kt index 16d9181a1d0..fb683567815 100644 --- a/compiler/testData/codegen/box/when/typeDisjunction.kt +++ b/compiler/testData/codegen/box/when/typeDisjunction.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND_FIR: JVM_IR fun foo(s: Any): String { val x = when (s) { is String -> s @@ -11,6 +10,3 @@ fun foo(s: Any): String { } fun box() = if (foo("OK") == "OK" && foo(42) == "42" && foo(true) == "") "OK" else "Fail" - - - diff --git a/compiler/testData/ir/irText/declarations/constValInitializers.fir.txt b/compiler/testData/ir/irText/declarations/constValInitializers.fir.txt index 82816b31109..559c563f4fd 100644 --- a/compiler/testData/ir/irText/declarations/constValInitializers.fir.txt +++ b/compiler/testData/ir/irText/declarations/constValInitializers.fir.txt @@ -65,8 +65,10 @@ FILE fqName: fileName:/constValInitializers.kt FIELD PROPERTY_BACKING_FIELD name:STR4 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY STRING_CONCATENATION type=kotlin.String - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:STR4 visibility:public modality:FINAL [const,val] BLOCK_BODY diff --git a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt index feaab7eb462..19975af3527 100644 --- a/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt +++ b/compiler/testData/ir/irText/expressions/breakContinueInWhen.fir.txt @@ -125,7 +125,8 @@ FILE fqName: fileName:/breakContinueInWhen.kt CALL 'public final fun plus (other: kotlin.Any?): kotlin.String declared in kotlin.String' type=kotlin.String origin=null $this: GET_VAR 'var s: kotlin.String [var] declared in .testContinueDoWhile' type=kotlin.String origin=null other: STRING_CONCATENATION type=kotlin.String - GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null CONST String type=kotlin.String value=";" condition: CALL 'public final fun less (arg0: kotlin.Int, arg1: kotlin.Int): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=LT arg0: GET_VAR 'var k: kotlin.Int [var] declared in .testContinueDoWhile' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/kt28006.fir.txt b/compiler/testData/ir/irText/expressions/kt28006.fir.txt index eab632fc42c..e4c8db6b135 100644 --- a/compiler/testData/ir/irText/expressions/kt28006.fir.txt +++ b/compiler/testData/ir/irText/expressions/kt28006.fir.txt @@ -41,7 +41,8 @@ FILE fqName: fileName:/kt28006.kt STRING_CONCATENATION type=kotlin.String CONST String type=kotlin.String value="\uD83E" CONST String type=kotlin.String value="\uDD17" - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:testConst3 visibility:public modality:FINAL [const,val] BLOCK_BODY @@ -51,8 +52,10 @@ FILE fqName: fileName:/kt28006.kt FIELD PROPERTY_BACKING_FIELD name:testConst4 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY STRING_CONCATENATION type=kotlin.String - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:testConst4 visibility:public modality:FINAL [const,val] BLOCK_BODY @@ -65,13 +68,15 @@ FILE fqName: fileName:/kt28006.kt STRING_CONCATENATION type=kotlin.String CONST String type=kotlin.String value="\uD83E" CONST String type=kotlin.String value="\uDD17" - GET_VAR 'x: kotlin.Int declared in .test1' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'x: kotlin.Int declared in .test1' type=kotlin.Int origin=null FUN name:test2 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.String VALUE_PARAMETER name:x index:0 type:kotlin.Int BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test2 (x: kotlin.Int): kotlin.String declared in ' STRING_CONCATENATION type=kotlin.String - GET_VAR 'x: kotlin.Int declared in .test2' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'x: kotlin.Int declared in .test2' type=kotlin.Int origin=null CONST String type=kotlin.String value="\uD83E" CONST String type=kotlin.String value="\uDD17" FUN name:test3 visibility:public modality:FINAL <> (x:kotlin.Int) returnType:kotlin.String @@ -79,7 +84,9 @@ FILE fqName: fileName:/kt28006.kt BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun test3 (x: kotlin.Int): kotlin.String declared in ' STRING_CONCATENATION type=kotlin.String - GET_VAR 'x: kotlin.Int declared in .test3' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'x: kotlin.Int declared in .test3' type=kotlin.Int origin=null CONST String type=kotlin.String value="\uD83E" CONST String type=kotlin.String value="\uDD17" - GET_VAR 'x: kotlin.Int declared in .test3' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'x: kotlin.Int declared in .test3' type=kotlin.Int origin=null diff --git a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.txt b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.txt index 5c05669f961..7898c5c8d2f 100644 --- a/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.txt +++ b/compiler/testData/ir/irText/expressions/objectReferenceInFieldInitializer.fir.txt @@ -21,8 +21,9 @@ FILE fqName: fileName:/objectReferenceInFieldInitializer.kt EXPRESSION_BODY STRING_CONCATENATION type=kotlin.String CONST String type=kotlin.String value="1234" - CALL 'private final fun (): kotlin.String declared in .A' type=kotlin.String origin=null - $this: GET_VAR ': .A declared in .A' type=.A origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'private final fun (): kotlin.String declared in .A' type=kotlin.String origin=null + $this: GET_VAR ': .A declared in .A' type=.A origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:private modality:FINAL <> ($this:.A) returnType:kotlin.String correspondingProperty: PROPERTY name:b visibility:private modality:FINAL [val] $this: VALUE_PARAMETER name: type:.A diff --git a/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt b/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt index 77cc40498a5..3c9f340f23e 100644 --- a/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt +++ b/compiler/testData/ir/irText/expressions/stringTemplates.fir.txt @@ -61,9 +61,11 @@ FILE fqName: fileName:/stringTemplates.kt FIELD PROPERTY_BACKING_FIELD name:test6 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY STRING_CONCATENATION type=kotlin.String - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null CONST String type=kotlin.String value=" " - CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test6 visibility:public modality:FINAL [val] BLOCK_BODY @@ -72,7 +74,8 @@ FILE fqName: fileName:/stringTemplates.kt PROPERTY name:test7 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test7 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test7 visibility:public modality:FINAL [val] BLOCK_BODY @@ -81,18 +84,20 @@ FILE fqName: fileName:/stringTemplates.kt PROPERTY name:test8 visibility:public modality:FINAL [val] FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun foo (): kotlin.String declared in ' type=kotlin.String origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test8 visibility:public modality:FINAL [val] BLOCK_BODY RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in ' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test8 type:kotlin.String visibility:private [final,static]' type=kotlin.String origin=null PROPERTY name:test9 visibility:public modality:FINAL [val] - FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Int visibility:private [final,static] + FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.String visibility:private [final,static] EXPRESSION_BODY - CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.Int + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: CALL 'public final fun (): kotlin.Int declared in ' type=kotlin.Int origin=null + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> () returnType:kotlin.String correspondingProperty: PROPERTY name:test9 visibility:public modality:FINAL [val] BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.Int declared in ' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.Int visibility:private [final,static]' type=kotlin.Int origin=null + RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in ' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:test9 type:kotlin.String visibility:private [final,static]' type=kotlin.String origin=null diff --git a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt index 7abf69d4138..810b6da3d94 100644 --- a/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt +++ b/compiler/testData/ir/irText/regressions/coercionInLoop.fir.txt @@ -25,7 +25,8 @@ FILE fqName: fileName:/coercionInLoop.kt then: RETURN type=kotlin.Nothing from='public final fun box (): kotlin.String declared in ' STRING_CONCATENATION type=kotlin.String CONST String type=kotlin.String value="Fail " - GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null + CALL 'public open fun toString (): kotlin.String declared in kotlin.Any' type=kotlin.String origin=null + $this: GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null VAR IR_TEMPORARY_VARIABLE name:tmp_0 type:kotlin.Int [val] GET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null SET_VAR 'var i: kotlin.Int [var] declared in .box' type=kotlin.Int origin=null