Correctly generate groups for composable lambdas with return values
Change-Id: I6253182a91b58a4f9727df9f9f1bb41109bc9180
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/AbstractIrTransformTest.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/AbstractIrTransformTest.kt
index 3f842f5..7ee34bb 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/AbstractIrTransformTest.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/AbstractIrTransformTest.kt
@@ -115,10 +115,14 @@
// replace source keys for start group calls
.replace(
Regex(
- "(%composer\\.start(Restart|Movable|Replaceable)Group\\()([-\\d]+)"
+ "(%composer\\.start(Restart|Movable|Replaceable)Group\\()-?((0b)?[-\\d]+)"
)
) {
- val key = it.groupValues[3].toInt()
+ val stringKey = it.groupValues[3]
+ val key = if (stringKey.startsWith("0b"))
+ Integer.parseInt(stringKey.drop(2), 2)
+ else
+ stringKey.toInt()
if (key in keySet) {
"${it.groupValues[1]}<!DUPLICATE KEY: $key!>"
} else {
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeCallLoweringTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeCallLoweringTests.kt
index 009a910..44e1faa 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeCallLoweringTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeCallLoweringTests.kt
@@ -57,6 +57,17 @@
}
@Test
+ fun testMoveFromIssue(): Unit = ensureSetup {
+ compose("""
+ """,
+ "Button(id=1, onClick=invalidate)"
+ ).then { activity ->
+ val tv = activity.findViewById<Button>(1)
+ tv.performClick()
+ }.then { }
+ }
+
+ @Test
fun testSimpleInlining(): Unit = ensureSetup {
compose("""
@Composable
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeMultiPlatformTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeMultiPlatformTests.kt
index ad056da..ec96852 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeMultiPlatformTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposeMultiPlatformTests.kt
@@ -55,8 +55,9 @@
final class JvmKt%Test%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
OUTERCLASS JvmKt Test (Landroidx/compose/Composer;II)V
final static INNERCLASS JvmKt%Test%1 null null
+ private final synthetic I %%key
private final synthetic I %%changed
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
}
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamSignatureTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamSignatureTests.kt
index fc71a48..ca4b33f 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamSignatureTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamSignatureTests.kt
@@ -50,9 +50,10 @@
public final static Bar(Landroidx/compose/Composer;II)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(Lkotlin/jvm/functions/Function3;I)V
+ <init>(Lkotlin/jvm/functions/Function3;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic Lkotlin/jvm/functions/Function3; %children
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%1 null null
@@ -68,8 +69,9 @@
OUTERCLASS TestKt Bar (Landroidx/compose/Composer;II)V
}
final class TestKt%Bar%2 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Bar%2 null null
@@ -236,10 +238,11 @@
public final static Example(Landroidx/compose/Composer;II)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(Ljava/lang/String;Lkotlin/jvm/functions/Function0;I)V
+ <init>(Ljava/lang/String;Lkotlin/jvm/functions/Function0;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic Ljava/lang/String; %a
private final synthetic Lkotlin/jvm/functions/Function0; %b
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%1 null null
@@ -255,8 +258,9 @@
OUTERCLASS TestKt Example (Landroidx/compose/Composer;II)V
}
final class TestKt%Example%2 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Example%2 null null
@@ -284,8 +288,9 @@
static <clinit>()V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%1 null null
@@ -465,9 +470,10 @@
public final static Foo(ILandroidx/compose/Composer;III)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(III)V
+ <init>(IIII)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %x
+ private final synthetic I %%key
private final synthetic I %%changed
private final synthetic I %%default
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
@@ -498,9 +504,10 @@
public final static test(Landroidx/compose/Composer;II)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(III)V
+ <init>(IIII)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %x
+ private final synthetic I %%key
private final synthetic I %%changed
private final synthetic I %%default
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
@@ -508,8 +515,9 @@
OUTERCLASS TestKt Foo (ILandroidx/compose/Composer;III)V
}
final class TestKt%test%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%test%1 null null
@@ -540,20 +548,22 @@
public final static Bar(ILjava/lang/String;Landroidx/compose/Composer;II)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(ILjava/lang/String;I)V
+ <init>(ILjava/lang/String;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %a
private final synthetic Ljava/lang/String; %b
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%1 null null
OUTERCLASS TestKt Foo (ILjava/lang/String;Landroidx/compose/Composer;II)V
}
final class TestKt%Bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(ILjava/lang/String;I)V
+ <init>(ILjava/lang/String;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %a
private final synthetic Ljava/lang/String; %b
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Bar%1 null null
@@ -579,17 +589,19 @@
public final static Bar(ILandroidx/compose/Composer;II)V
}
final class TestKt%Foo%2 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%2 null null
OUTERCLASS TestKt Foo (Landroidx/compose/Composer;II)V
}
final class TestKt%Bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(II)V
+ <init>(III)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %a
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Bar%1 null null
@@ -616,8 +628,9 @@
static <clinit>()V
}
final class TestKt%Bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Bar%1 null null
@@ -660,9 +673,10 @@
OUTERCLASS TestKt Bar (Lkotlin/jvm/functions/Function3;Landroidx/compose/Composer;II)V
}
final class TestKt%Bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(Lkotlin/jvm/functions/Function3;I)V
+ <init>(Lkotlin/jvm/functions/Function3;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic Lkotlin/jvm/functions/Function3; %children
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Bar%1 null null
@@ -699,9 +713,10 @@
public final static App(ILandroidx/compose/Composer;II)V
}
final class TestKt%Wrap%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(Lkotlin/jvm/functions/Function4;I)V
+ <init>(Lkotlin/jvm/functions/Function4;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic Lkotlin/jvm/functions/Function4; %children
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Wrap%1 null null
@@ -727,9 +742,10 @@
OUTERCLASS TestKt%App%1 invoke (ILandroidx/compose/Composer;II)V
}
final class TestKt%App%2 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(II)V
+ <init>(III)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %x
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%App%2 null null
@@ -759,9 +775,10 @@
public bar(Landroidx/compose/Composer;II)V
}
final class FooImpl%bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(LFooImpl;I)V
+ <init>(LFooImpl;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic LFooImpl; %tmp0_rcvr
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS FooImpl%bar%1 null null
@@ -793,9 +810,10 @@
public synthetic <init>(Lkotlin/jvm/internal/DefaultConstructorMarker;)V
}
final class Ambient2%foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(LAmbient2;I)V
+ <init>(LAmbient2;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic LAmbient2; %tmp0_rcvr
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS Ambient2%foo%1 null null
@@ -915,8 +933,9 @@
public final static Example(Landroidx/compose/Composer;II)V
}
final class TestKt%Example%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Example%1 null null
@@ -947,9 +966,10 @@
public bar(Landroidx/compose/Composer;II)V
}
final class FooImpl%bar%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(LFooImpl;I)V
+ <init>(LFooImpl;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic LFooImpl; %tmp0_rcvr
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS FooImpl%bar%1 null null
@@ -987,8 +1007,9 @@
public final static synthetic access%Foo%goo(Landroidx/compose/Composer;II)V
}
final class TestKt%Wat%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Wat%1 null null
@@ -1002,9 +1023,10 @@
OUTERCLASS TestKt Foo (ILandroidx/compose/Composer;II)V
}
final class TestKt%Foo%Bar%baz%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(LTestKt%Foo%Bar;I)V
+ <init>(LTestKt%Foo%Bar;II)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic LTestKt%Foo%Bar; %tmp0_rcvr
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%Bar%baz%1 null null
@@ -1012,17 +1034,19 @@
OUTERCLASS TestKt%Foo%Bar baz (Landroidx/compose/Composer;II)V
}
final class TestKt%Foo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(II)V
+ <init>(III)V
public final invoke(Landroidx/compose/Composer;II)V
private final synthetic I %x
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%1 null null
OUTERCLASS TestKt Foo (ILandroidx/compose/Composer;II)V
}
final class TestKt%Foo%goo%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Foo%goo%1 null null
@@ -1115,8 +1139,9 @@
public final static Example(Landroidx/compose/Composer;II)V
}
final class TestKt%Example%1 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Example%1 null null
@@ -1143,8 +1168,9 @@
public final static Test(Landroidx/compose/Composer;II)V
}
final class TestKt%Test%2 extends kotlin/jvm/internal/Lambda implements kotlin/jvm/functions/Function3 {
- <init>(I)V
+ <init>(II)V
public final invoke(Landroidx/compose/Composer;II)V
+ private final synthetic I %%key
private final synthetic I %%changed
public synthetic bridge invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
final static INNERCLASS TestKt%Test%2 null null
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamTransformTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamTransformTests.kt
index 0cf4181..759816d 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamTransformTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ComposerParamTransformTests.kt
@@ -57,7 +57,7 @@
"""
val bar: Int
get() {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0 = 123
%composer.endReplaceableGroup()
return tmp0
@@ -65,7 +65,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<bar>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<bar>:Test.kt")
bar
%composer.endReplaceableGroup()
}
@@ -97,7 +97,7 @@
@ComposableContract(restartable = false)
@Composable
override fun bar(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
%composer.endReplaceableGroup()
}
}
@@ -129,18 +129,18 @@
@ComposableContract(restartable = false)
@Composable
fun Wat(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
%composer.endReplaceableGroup()
}
@ComposableContract(restartable = false)
@Composable
fun Foo(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<Wat()>,<goo()>,<baz()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<Wat()>,<goo()>,<baz()>:Test.kt")
Wat(%composer, <>, 0)
@ComposableContract(restartable = false)
@Composable
fun goo(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<Wat()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<Wat()>:Test.kt")
Wat(%composer, <>, 0)
%composer.endReplaceableGroup()
}
@@ -148,7 +148,7 @@
@ComposableContract(restartable = false)
@Composable
fun baz(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<Wat()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<Wat()>:Test.kt")
Wat(%composer, <>, 0)
%composer.endReplaceableGroup()
}
@@ -231,7 +231,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<Exampl...>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<Exampl...>:Test.kt")
Example(%composer, <>, 0)
%composer.endReplaceableGroup()
}
@@ -253,14 +253,14 @@
"""
@Composable
fun Example(children: Function3<Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<childr...>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<childr...>:Test.kt")
children(%composer, <>, 0b0110 and %changed)
%composer.endReplaceableGroup()
}
@ComposableContract(restartable = false)
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<Exampl...>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<Exampl...>:Test.kt")
Example({ %composer: Composer<*>?, %key: Int, %changed: Int ->
%composer.startReplaceableGroup(<>, "C:Test.kt")
%composer.endReplaceableGroup()
@@ -286,7 +286,7 @@
"""
val myProperty: Function0<Unit>
get() {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0 = {
}
%composer.endReplaceableGroup()
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTests.kt
index 8b41618..ff662f4 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTests.kt
@@ -35,7 +35,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
NA()
}
@@ -61,7 +61,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A()>")
A(%composer, <>, 0)
@@ -94,7 +94,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A(a)>")
A(a, %composer, <>, 0)
@@ -128,7 +128,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<B()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<B()>:Test.kt")
if (B(%composer, <>, 0)) {
NA()
} else {
@@ -162,7 +162,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (%composer.startReplaceableGroup(<>, "<B(a)>")
val tmp0_group = B(a, %composer, <>, 0)
%composer.endReplaceableGroup()
@@ -198,7 +198,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0_subject = x
when {
tmp0_subject == 0 -> {
@@ -235,7 +235,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0_subject = x
when {
tmp0_subject == 0 -> {
@@ -278,7 +278,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val y = val tmp0_subject = x
when {
tmp0_subject == 0 -> {
@@ -324,7 +324,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
when {
x < 0 -> {
%composer.startReplaceableGroup(<>, "<A(a)>")
@@ -366,7 +366,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
when {
x < 0 -> {
%composer.startReplaceableGroup(<>, "<A(a)>")
@@ -409,7 +409,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
when {
%composer.startReplaceableGroup(<>, "<R(a)>")
val tmp0_group = x == R(a, %composer, 0b01110111010101111000001000010110, 0)
@@ -452,7 +452,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>)
when {
%composer.startReplaceableGroup(<>, "<R(a)>")
@@ -492,7 +492,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int?, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0_safe_receiver = x
when {
tmp0_safe_receiver == null -> {
@@ -525,7 +525,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int?, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val y = val tmp0_elvis_lhs = x
when {
tmp0_elvis_lhs == null -> {
@@ -562,7 +562,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: List<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>:Test.kt")
val tmp0_iterator = items.iterator()
while (tmp0_iterator.hasNext()) {
val i = tmp0_iterator.next()
@@ -590,7 +590,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: List<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "*<P(i)>")
val tmp0_iterator = items.iterator()
while (tmp0_iterator.hasNext()) {
@@ -620,7 +620,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<L()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<L()>:Test.kt")
val tmp0_iterator = L(%composer, <>, 0).iterator()
while (tmp0_iterator.hasNext()) {
val i = tmp0_iterator.next()
@@ -650,7 +650,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: MutableList<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(item...>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(item...>:Test.kt")
while (items.isNotEmpty()) {
val item = items.removeAt(items.size - 1)
P(item, %composer, <>, 0)
@@ -679,7 +679,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: MutableList<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "*<P(item...>")
while (items.isNotEmpty()) {
val item = items.removeAt(items.size - 1)
@@ -709,7 +709,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<B()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<B()>:Test.kt")
while (B(%composer, <>, 0)) {
print("hello world")
}
@@ -735,7 +735,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "*<B()>")
while (B(%composer, <>, 0)) {
print("hello world")
@@ -764,7 +764,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<B()>,<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<B()>,<A()>:Test.kt")
while (B(%composer, <>, 0)) {
A(%composer, <>, 0)
}
@@ -791,7 +791,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A(b)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A(b)>:Test.kt")
%composer.startReplaceableGroup(<>, "*<B()>,<A(a)>")
while (B(%composer, <>, 0)) {
A(a, %composer, <>, 0)
@@ -820,7 +820,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A()>")
A(%composer, <>, 0)
@@ -853,7 +853,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
if (x > 0) {
%composer.endReplaceableGroup()
return
@@ -880,7 +880,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A()>")
A(%composer, <>, 0)
@@ -915,7 +915,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
if (x > 0) {
val tmp1_return = 1
%composer.endReplaceableGroup()
@@ -944,7 +944,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C<A()>,<R()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>,<R()>:Test.kt")
A(%composer, <>, 0)
val tmp0 = R(%composer, <>, 0)
%composer.endReplaceableGroup()
@@ -968,7 +968,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C<R()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<R()>:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<R()>")
val tmp1_return = R(%composer, <>, 0)
@@ -1011,7 +1011,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>,<P(l)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>,<P(l)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
val j = i
@@ -1060,7 +1060,7 @@
"""
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C*<P(i)>,<P(l)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C*<P(i)>,<P(l)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
val j = i
@@ -1107,7 +1107,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
if (i == 0) {
@@ -1138,7 +1138,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
P(i, %composer, <>, 0)
@@ -1172,7 +1172,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>,<P(j)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>,<P(j)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
val j = i
@@ -1208,7 +1208,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "*<P(i)>,<P(i)>")
while (items.hasNext()) {
val i = items.next()
@@ -1243,7 +1243,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
if (i == 0) {
@@ -1275,7 +1275,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
P(i, %composer, <>, 0)
@@ -1308,7 +1308,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(items: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<P(i)>,<P(i)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<P(i)>,<P(i)>:Test.kt")
while (items.hasNext()) {
val i = items.next()
P(i, %composer, <>, 0)
@@ -1340,7 +1340,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(a: Iterator<Int>, b: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A()>:Test.kt")
while (a.hasNext()) {
val x = a.next()
if (x > 100) {
@@ -1376,7 +1376,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(a: Iterator<Int>, b: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A()>:Test.kt")
a@while (a.hasNext()) {
val x = a.next()
%composer.startReplaceableGroup(<>, "*<A()>")
@@ -1427,7 +1427,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(a: Iterator<Int>, b: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A()>:Test.kt")
a@while (a.hasNext()) {
val x = a.next()
if (x == 0) {
@@ -1476,7 +1476,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(a: Iterator<Int>, b: Iterator<Int>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "*<A()>")
a@while (a.hasNext()) {
%composer.startReplaceableGroup(<>, "*<A()>")
@@ -1510,7 +1510,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A()>")
%composer.startReplaceableGroup(<>, "*<A()>")
@@ -1546,7 +1546,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A()>,*<A()>")
A(%composer, <>, 0)
@@ -1579,7 +1579,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "*<A()>")
while (x > 0) {
@@ -1611,7 +1611,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
while (x > 0) {
%composer.startMovableGroup(<>, x, "<A()>")
A(%composer, <>, 0)
@@ -1641,7 +1641,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
while (x > 0) {
%composer.startMovableGroup(<>, x, "<A(a)>")
A(a, %composer, <>, 0)
@@ -1672,7 +1672,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A(b)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A(b)>:Test.kt")
while (x > 0) {
%composer.startMovableGroup(<>, x, "<A(a)>")
A(a, %composer, <>, 0)
@@ -1701,7 +1701,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A(a)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A(a)>:Test.kt")
while (x > 0) {
A(a, %composer, <>, 0)
%composer.startMovableGroup(<>, x, "<A(b)>")
@@ -1731,7 +1731,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<A(a)>,<A(c)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<A(a)>,<A(c)>:Test.kt")
while (x > 0) {
A(a, %composer, <>, 0)
%composer.startMovableGroup(<>, x, "<A(b)>")
@@ -1758,7 +1758,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
%composer.startMovableGroup(<>, x, "<A()>")
A(%composer, <>, 0)
%composer.endMovableGroup()
@@ -1782,7 +1782,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A(b)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A(b)>:Test.kt")
%composer.startMovableGroup(<>, x, "<A(a)>")
A(a, %composer, <>, 0)
%composer.endMovableGroup()
@@ -1807,7 +1807,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A(a)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A(a)>:Test.kt")
A(a, %composer, <>, 0)
%composer.startMovableGroup(<>, x, "<A(b)>")
A(b, %composer, <>, 0)
@@ -1833,7 +1833,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>)
%composer.startMovableGroup(<>, x, "<A()>")
@@ -1866,7 +1866,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A(b)>")
%composer.startMovableGroup(<>, x, "<A(a)>")
@@ -1900,7 +1900,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
if (x > 0) {
%composer.startReplaceableGroup(<>, "<A(a)>")
A(a, %composer, <>, 0)
@@ -1931,7 +1931,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(a: Int, b: Int, c: Int, d: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
%composer.startMovableGroup(<>, %composer.joinKey(%composer.joinKey(%composer.joinKey(a, b), c), d), "<A()>")
A(%composer, <>, 0)
%composer.endMovableGroup()
@@ -1956,7 +1956,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C*<R()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C*<R()>:Test.kt")
while (x > 0) {
%composer.startMovableGroup(<>, R(%composer, <>, 0), "<A()>")
A(%composer, <>, 0)
@@ -1980,7 +1980,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<P(y)>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<P(y)>:Test.kt")
val y =
%composer.startMovableGroup(<>, x, "<R()>")
val tmp0 = R(%composer, <>, 0)
@@ -2008,7 +2008,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0 = if (x > 0) {
%composer.startReplaceableGroup(<>)
val tmp4_group =
@@ -2082,7 +2082,7 @@
@ComposableContract(restartable = false)
@Composable
fun Simple(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "<A()>")
run {
A(%composer, <>, 0)
@@ -2094,7 +2094,7 @@
@ComposableContract(restartable = false)
@Composable
fun WithReturn(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
%composer.startReplaceableGroup(<>, "<A()>")
run {
A(%composer, <>, 0)
@@ -2109,7 +2109,7 @@
@ComposableContract(restartable = false)
@Composable
fun NoCalls(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
run {
println("hello world")
}
@@ -2119,7 +2119,7 @@
@ComposableContract(restartable = false)
@Composable
fun NoCallsAfter(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
run {
A(%composer, <>, 0)
}
@@ -2145,7 +2145,7 @@
"""
@Composable
fun Example(x: Int?, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(c)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(c)>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -2202,7 +2202,7 @@
"""
@Composable
fun Example(x: Int?, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A()>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A()>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -2239,7 +2239,7 @@
"""
@Composable
fun <T> provided(value: T, %composer: Composer<*>?, %key: Int, %changed: Int): State<T> {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val tmp0 = state(null, {
val tmp0_return = value
tmp0_return
@@ -2269,7 +2269,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
val tmp0 =
val tmp1_group = x.let { it: Int ->
A(%composer, <>, 0)
@@ -2296,7 +2296,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<W>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<W>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
W(composableLambda(%composer, <>, true, "C<A()>:Test.kt") { %composer: Composer<*>?, %key: Int, %changed: Int ->
if (%changed and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@@ -2328,7 +2328,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<IW>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<IW>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
IW({ %composer: Composer<*>?, %key: Int, %changed: Int ->
%composer.startReplaceableGroup(<>, "C<A()>:Test.kt")
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTestsNoSource.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTestsNoSource.kt
index bcf3209..d9bb39b 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTestsNoSource.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/ControlFlowTransformTestsNoSource.kt
@@ -33,7 +33,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C")
+ %composer.startRestartGroup(<> xor %key, "C")
if (%changed !== 0 || !%composer.skipping) {
A(a, %composer, <>, 0)
A(b, %composer, <>, 0)
@@ -59,7 +59,7 @@
"""
@Composable
private fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key)
+ %composer.startRestartGroup(<> xor %key)
if (%changed !== 0 || !%composer.skipping) {
A(a, %composer, <>, 0)
A(b, %composer, <>, 0)
@@ -86,7 +86,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C")
+ %composer.startRestartGroup(<> xor %key, "C")
if (%changed !== 0 || !%composer.skipping) {
W(composableLambda(%composer, <>, true, null) { %composer: Composer<*>?, %key: Int, %changed: Int ->
if (%changed and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@@ -118,7 +118,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C")
+ %composer.startRestartGroup(<> xor %key, "C")
if (%changed !== 0 || !%composer.skipping) {
IW({ %composer: Composer<*>?, %key: Int, %changed: Int ->
if (%changed and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/DefaultParamTransformTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/DefaultParamTransformTests.kt
index 9cc3cde..325bf21 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/DefaultParamTransformTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/DefaultParamTransformTests.kt
@@ -58,7 +58,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(1)>,<B()>,<B(2)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(1)>,<B()>,<B(2)>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
A(1, %composer, <>, 0b0110)
B(0, %composer, <>, 0, 0b0001)
@@ -91,7 +91,7 @@
"""
@Composable
fun Example(foo: Foo, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val foo = foo
if (%default and 0b0001 !== 0) {
@@ -113,7 +113,7 @@
}
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<Exampl...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Exampl...>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
Example(Foo(0), %composer, <>, 0, 0b0001)
} else {
@@ -141,7 +141,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(0,>,<A(a>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(0,>,<A(a>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
A(0, 1, 2, 0, 0, %composer, <>, 0b01111110, 0b00011000)
A(0, 0, 2, 0, 0, %composer, <>, 0b01100110, 0b00011010)
@@ -169,7 +169,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val x = x
if (%changed and 0b0110 === 0) {
@@ -213,7 +213,7 @@
"""
@Composable
fun A(a: Int, b: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val a = a
val b = b
@@ -299,7 +299,7 @@
"""
@Composable
fun Example(a00: Int, a01: Int, a02: Int, a03: Int, a04: Int, a05: Int, a06: Int, a07: Int, a08: Int, a09: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int, a24: Int, a25: Int, a26: Int, a27: Int, a28: Int, a29: Int, a30: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %changed1: Int, %changed2: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val %dirty1 = %changed1
val %dirty2 = %changed2
@@ -640,7 +640,7 @@
"""
@Composable
fun Example(a00: Int, a01: Int, a02: Int, a03: Int, a04: Int, a05: Int, a06: Int, a07: Int, a08: Int, a09: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int, a24: Int, a25: Int, a26: Int, a27: Int, a28: Int, a29: Int, a30: Int, a31: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %changed1: Int, %changed2: Int, %default: Int, %default1: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val %dirty1 = %changed1
val %dirty2 = %changed2
@@ -991,7 +991,7 @@
"""
@Composable
fun Example(a00: Int, a01: Int, a02: Int, a03: Int, a04: Int, a05: Int, a06: Int, a07: Int, a08: Int, a09: Foo?, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, a16: Int, a17: Int, a18: Int, a19: Int, a20: Int, a21: Int, a22: Int, a23: Int, a24: Int, a25: Int, a26: Int, a27: Int, a28: Int, a29: Int, a30: Int, a31: Foo?, %composer: Composer<*>?, %key: Int, %changed: Int, %changed1: Int, %changed2: Int, %default: Int, %default1: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val %dirty1 = %changed1
val %dirty2 = %changed2
@@ -1324,7 +1324,7 @@
@ComposableContract(restartable = false)
@Composable
fun foo(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startReplaceableGroup(%key, "C:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C:Test.kt")
val x = if (%default and 0b0001 !== 0) 0 else x
%composer.endReplaceableGroup()
}
@@ -1333,7 +1333,7 @@
@ComposableContract(restartable = false)
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startReplaceableGroup(%key, "C<foo()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<foo()>:Test.kt")
foo(0, %composer, <>, 0, 0b0001)
%composer.endReplaceableGroup()
}
diff --git a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/FunctionBodySkippingTransformTests.kt b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/FunctionBodySkippingTransformTests.kt
index 44bba37..187604a 100644
--- a/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/FunctionBodySkippingTransformTests.kt
+++ b/compose/compose-compiler-hosted/integration-tests/src/test/java/androidx/compose/plugins/kotlin/FunctionBodySkippingTransformTests.kt
@@ -63,7 +63,7 @@
"""
@Composable
fun Test(x: Int, y: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<Wrap>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Wrap>:Test.kt")
val %dirty = %changed
val x = x
val y = y
@@ -128,7 +128,7 @@
"""
@Composable
fun Test(x: Int, y: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<Wrap>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Wrap>:Test.kt")
val %dirty = %changed
val x = x
val y = y
@@ -150,7 +150,7 @@
y = 0
}
Wrap(composableLambda(%composer, <>, false, "C:Test.kt") { %composer: Composer<*>?, %key: Int, %changed: Int ->
- %composer.startReplaceableGroup(%key, "<A(x)>")
+ %composer.startReplaceableGroup(<> xor %key, "<A(x)>")
A(x, 0, %composer, <>, 0b0110 and %dirty, 0b0010)
%composer.endReplaceableGroup()
}, %composer, <>, 0b0110)
@@ -239,7 +239,7 @@
"""
@Composable
fun RowColumnImpl(orientation: LayoutOrientation, modifier: Modifier?, arrangement: Vertical?, crossAxisAlignment: Horizontal?, crossAxisSize: SizeMode?, children: Function3<Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val modifier = modifier
val arrangement = arrangement
@@ -306,7 +306,7 @@
}
@Composable
fun Column(modifier: Modifier?, verticalArrangement: Vertical?, horizontalGravity: Horizontal?, children: Function3<Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<RowCol...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<RowCol...>:Test.kt")
val %dirty = %changed
val modifier = modifier
val verticalArrangement = verticalArrangement
@@ -381,7 +381,7 @@
"""
@Composable
fun SimpleBox(modifier: Modifier?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val modifier = modifier
if (%default and 0b0001 !== 0) {
@@ -418,7 +418,7 @@
"""
@Composable
fun Example(a: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val a = a
if (%changed and 0b0110 === 0) {
@@ -473,7 +473,7 @@
"""
@Composable
fun SimpleBox(modifier: Modifier?, shape: Shape?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val modifier = modifier
val shape = shape
@@ -532,7 +532,7 @@
"""
@Composable
fun SimpleBox(modifier: Modifier?, children: Function3<Composer<*>, Int, Int, Unit>?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val modifier = modifier
val children = children
@@ -650,7 +650,7 @@
"""
@Composable
fun SomeThing(children: Function3<Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(children)) 0b0100 else 0b0010
@@ -665,7 +665,7 @@
}
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<SomeTh...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<SomeTh...>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
SomeThing(composableLambda(%composer, <>, true, "C:Test.kt") { %composer: Composer<*>?, %key: Int, %changed: Int ->
if (%changed and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@@ -697,7 +697,7 @@
"""
@Composable
fun B(values: IntArray, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
%composer.startReplaceableGroup(values.size)
val tmp0_iterator = values.iterator()
@@ -736,7 +736,7 @@
"""
@Composable
fun B(values: Array<out Foo>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
%composer.startReplaceableGroup(values.size)
val tmp0_iterator = values.iterator()
@@ -775,7 +775,7 @@
"""
@Composable
fun B(values: Array<out Foo>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
print(values)
%composer.endRestartGroup()?.updateScope { %composer: Composer<*>?, %key: Int, %force: Int ->
B(*values, %composer, %key, %changed or 0b0001)
@@ -804,7 +804,7 @@
val counter: Int = 0
@Composable
fun A(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
%dirty = %dirty or 0b0110
if (%dirty and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@@ -819,7 +819,7 @@
}
@Composable
fun B(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
print(counter)
val tmp0_rcvr = <this>
@@ -845,7 +845,7 @@
"""
@Composable
fun Example(a: Int, b: Int, c: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<makeIn...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<makeIn...>:Test.kt")
val %dirty = %changed
val a = a
val b = b
@@ -912,7 +912,7 @@
"""
@Composable
fun Wrap(y: Int, children: Function4<@[ParameterName(name = 'x')] Int, Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<childr...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<childr...>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(y)) 0b0100 else 0b0010
@@ -931,7 +931,7 @@
}
@Composable
fun Test(x: Int, y: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<Wrap(1...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Wrap(1...>:Test.kt")
val %dirty = %changed
val x = x
val y = y
@@ -988,7 +988,7 @@
"""
@Composable
fun Test(x: Int, y: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int): Int {
- %composer.startReplaceableGroup(%key, "C<A(x,>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A(x,>:Test.kt")
val x = if (%default and 0b0001 !== 0) 0 else x
val y = if (%default and 0b0010 !== 0) 0 else y
A(x, y, %composer, <>, 0b0110 and %changed or 0b00011000 and %changed, 0)
@@ -1035,7 +1035,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int): Int {
- %composer.startReplaceableGroup(%key, "C<A()>:Test.kt")
+ %composer.startReplaceableGroup(<> xor %key, "C<A()>:Test.kt")
val tmp0 = A(0, 0, %composer, <>, 0, 0b0011)
%composer.endReplaceableGroup()
return tmp0
@@ -1056,7 +1056,7 @@
"""
@Composable
fun Test(x: Int, y: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(y>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(y>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1096,7 +1096,7 @@
"""
@Composable
fun CanSkip(a: Int, b: Foo?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val a = a
val b = b
@@ -1135,7 +1135,7 @@
}
@Composable
fun CannotSkip(a: Int, b: Foo, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
print("Hello World")
%composer.endRestartGroup()?.updateScope { %composer: Composer<*>?, %key: Int, %force: Int ->
CannotSkip(a, b, %composer, %key, %changed or 0b0001)
@@ -1143,7 +1143,7 @@
}
@Composable
fun NoParams(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
print("Hello World")
} else {
@@ -1170,7 +1170,7 @@
"""
@Composable
fun Test(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A()>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A()>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
A(%composer, <>, 0)
} else {
@@ -1197,7 +1197,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(x)>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1235,7 +1235,7 @@
"""
@Composable
fun A(text: String, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<B(text...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<B(text...>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(text)) 0b0100 else 0b0010
@@ -1251,7 +1251,7 @@
}
@Composable
fun B(text: String, color: Color, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val color = color
if (%default and 0b0001 !== 0) {
@@ -1342,7 +1342,7 @@
"""
@Composable
fun A(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<D>,<C({})>,<{}>,<C(stab...>,<C(16.d...>,<C(Dp(1...>,<C(16.d...>,<C(norm...>,<C(Int....>,<C(stab...>,<C(Modi...>,<C(Foo....>,<C(cons...>,<C(123)>,<C(123>,<C(x)>,<C(x>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<D>,<C({})>,<{}>,<C(stab...>,<C(16.d...>,<C(Dp(1...>,<C(16.d...>,<C(norm...>,<C(Int....>,<C(stab...>,<C(Modi...>,<C(Foo....>,<C(cons...>,<C(123)>,<C(123>,<C(x)>,<C(x>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
val x = 123
D(composableLambda(%composer, <>, true, "C:Test.kt") { %composer: Composer<*>?, %key: Int, %changed: Int ->
@@ -1379,7 +1379,7 @@
}
@Composable
fun B(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<C(Math...>,<C(Math...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<C(Math...>,<C(Math...>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
C(random(), %composer, <>, 0)
C(random() / 100.0f, %composer, <>, 0)
@@ -1406,7 +1406,7 @@
"""
@Composable
fun Example(%composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<D>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<D>:Test.kt")
if (%changed !== 0 || !%composer.skipping) {
D(composableLambda(%composer, <>, true, "C:Test.kt") { %composer: Composer<*>?, %key: Int, %changed: Int ->
if (%changed and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@@ -1440,7 +1440,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<A(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(x)>:Test.kt")
val %dirty = %changed
val x = x
if (%default and 0b0001 !== 0) {
@@ -1478,7 +1478,7 @@
"""
@Composable
fun Test(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<I()>,<A(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<I()>,<A(x)>:Test.kt")
val %dirty = %changed
val x = x
if (%changed and 0b0110 === 0) {
@@ -1524,7 +1524,7 @@
"""
@Composable
fun Test(x: Foo, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<A(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(x)>:Test.kt")
A(x, %composer, <>, 0b0110 and %changed)
%composer.endRestartGroup()?.updateScope { %composer: Composer<*>?, %key: Int, %force: Int ->
Test(x, %composer, %key, %changed or 0b0001)
@@ -1548,7 +1548,7 @@
"""
@Composable
fun Test(x: Foo?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<A(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(x)>:Test.kt")
val %dirty = %changed
val x = x
if (%default and 0b0001 !== 0) {
@@ -1594,7 +1594,7 @@
"""
@Composable
fun Test(a: Int, b: Boolean, c: Int, d: Foo?, e: List<Int>?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<A(a,>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<A(a,>:Test.kt")
val %dirty = %changed
val c = c
val d = d
@@ -1669,7 +1669,7 @@
"""
@Composable
fun X(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<X(x>,<X(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<X(x>,<X(x)>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1711,7 +1711,7 @@
"""
@Composable
fun A(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<B(>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<B(>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1807,7 +1807,7 @@
"""
@Composable
fun A(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<Provid...>,<B(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Provid...>,<B(x)>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1863,7 +1863,7 @@
"""
@Composable
fun A(x: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<foo(x)>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<foo(x)>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(x)) 0b0100 else 0b0010
@@ -1871,7 +1871,7 @@
if (%dirty and 0b0011 xor 0b0010 !== 0 || !%composer.skipping) {
@Composable
fun foo(y: Int, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<B(x,>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<B(x,>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(y)) 0b0100 else 0b0010
@@ -1960,7 +1960,7 @@
"""
@Composable
fun Example(a00: Int, a01: Int, a02: Int, a03: Int, a04: Int, a05: Int, a06: Int, a07: Int, a08: Int, a09: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<Exampl...>,<Exampl...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Exampl...>,<Exampl...>:Test.kt")
val %dirty = %changed
val a00 = a00
val a01 = a01
@@ -2177,7 +2177,7 @@
"""
@Composable
fun Example(a00: Int, a01: Int, a02: Int, a03: Int, a04: Int, a05: Int, a06: Int, a07: Int, a08: Int, a09: Int, a10: Int, a11: Int, a12: Int, a13: Int, a14: Int, a15: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %changed1: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<Exampl...>,<Exampl...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<Exampl...>,<Exampl...>:Test.kt")
val %dirty = %changed
val %dirty1 = %changed1
val a00 = a00
@@ -2403,7 +2403,7 @@
"""
@Composable
fun Example(wontChange: Int, mightChange: Int, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C<curren...>,<A(wont...>,<A(migh...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<curren...>,<A(wont...>,<A(migh...>:Test.kt")
val %dirty = %changed
val wontChange = wontChange
val mightChange = mightChange
@@ -2456,7 +2456,7 @@
"""
@Composable
fun Example(content: Function3<Composer<*>, Int, Int, Unit>, %composer: Composer<*>?, %key: Int, %changed: Int) {
- %composer.startRestartGroup(%key, "C<invoke...>:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C<invoke...>:Test.kt")
val %dirty = %changed
if (%changed and 0b0110 === 0) {
%dirty = %dirty or if (%composer.changed(content)) 0b0100 else 0b0010
@@ -2474,6 +2474,27 @@
)
@Test
+ fun testComposableLambdasWithReturnGetGroups(): Unit = comparisonPropagation(
+ """
+ """,
+ """
+ fun A(factory: @Composable () -> Int): Unit {}
+ fun B() = A { 123 }
+ """,
+ """
+ fun A(factory: Function3<Composer<*>, Int, Int, Int>) { }
+ fun B() {
+ return A { %composer: Composer<*>?, %key: Int, %changed: Int ->
+ %composer.startReplaceableGroup(<> xor %key)
+ val tmp0 = 123
+ %composer.endReplaceableGroup()
+ tmp0
+ }
+ }
+ """
+ )
+
+ @Test
fun testDefaultsIssue(): Unit = comparisonPropagation(
"""
""",
@@ -2494,7 +2515,7 @@
"""
@Composable
fun Box2(modifier: Modifier?, paddingStart: Dp, children: Function3<Composer<*>, Int, Int, Unit>?, %composer: Composer<*>?, %key: Int, %changed: Int, %default: Int) {
- %composer.startRestartGroup(%key, "C:Test.kt")
+ %composer.startRestartGroup(<> xor %key, "C:Test.kt")
val %dirty = %changed
val modifier = modifier
val paddingStart = paddingStart
diff --git a/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/ComposableFunctionBodyTransformer.kt b/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/ComposableFunctionBodyTransformer.kt
index 06a02fe..86c0f4d 100644
--- a/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/ComposableFunctionBodyTransformer.kt
+++ b/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/ComposableFunctionBodyTransformer.kt
@@ -603,7 +603,8 @@
val isLambda = declaration.isLambda()
// we use != false because a null value is treated as "tracked"
- val isTracked = declaration.descriptor.composableTrackedContract() != false
+ val isTracked = declaration.descriptor.composableTrackedContract() != false &&
+ declaration.returnType.isUnit()
if (declaration.body == null) return declaration
@@ -752,7 +753,7 @@
irStartReplaceableGroup(
body,
scope.sourceInformation,
- irGet(scope.keyParameter!!)
+ irXor(declaration.irSourceKey(), irGet(scope.keyParameter!!))
)
else
null,
@@ -1065,7 +1066,7 @@
irStartRestartGroup(
body,
scope.sourceInformation,
- irGet(scope.keyParameter!!)
+ irXor(declaration.irSourceKey(), irGet(scope.keyParameter!!))
),
*skipPreamble.statements.toTypedArray(),
transformedBody,
@@ -1606,7 +1607,7 @@
putValueArgument(
keyIndex,
- irGet(fn.valueParameters[1])
+ irGet(scope.keyParameter!!)
)
// the call in updateScope needs to *always* have the low bit set to 1.
diff --git a/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/IrSourcePrinter.kt b/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/IrSourcePrinter.kt
index 9dc454a..61626ad 100644
--- a/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/IrSourcePrinter.kt
+++ b/compose/compose-compiler-hosted/src/main/java/androidx/compose/plugins/kotlin/compiler/lower/IrSourcePrinter.kt
@@ -108,6 +108,7 @@
import org.jetbrains.kotlin.resolve.descriptorUtil.isAnnotationConstructor
import org.jetbrains.kotlin.types.Variance
import org.jetbrains.kotlin.utils.Printer
+import kotlin.math.abs
import java.util.Locale
fun IrElement.dumpSrc(): String {
@@ -925,14 +926,14 @@
private fun intAsBinaryString(value: Int): String {
if (value == 0) return "0"
- var current = value
+ var current = abs(value)
var result = ""
while (current != 0 || result.length % 4 != 0) {
val nextBit = current and 1 != 0
current = current shr 1
result = "${if (nextBit) "1" else "0"}$result"
}
- return "0b$result"
+ return "${if (value < 0) "-" else ""}0b$result"
}
override fun <T> visitConst(expression: IrConst<T>) {