-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent capturing param meta across crossinline boundary
Crossinline function can technically be in a different composition. Fixes: [343801379](https://issuetracker.google.com/343801379) Relnote: Stop capturing parameter meta across crossinline boundary.
- Loading branch information
Showing
8 changed files
with
258 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...pingModeTransformTests/unstableCrossinline[useFir = false, intrinsicRemember = false].txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Source | ||
// ------------------------------------------ | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.runtime.ReadOnlyComposable | ||
|
||
|
||
@Composable fun Scratch(vm: MyUnstableViewModel) { | ||
Dialog( | ||
content = slotIfNotNull(vm.text) { | ||
Button( | ||
onClick = vm::onClickyClicky | ||
) | ||
} | ||
) | ||
} | ||
|
||
// | ||
// Transformed IR | ||
// ------------------------------------------ | ||
|
||
@Composable | ||
fun Scratch(vm: MyUnstableViewModel, %composer: Composer?, %changed: Int) { | ||
%composer = %composer.startRestartGroup(<>) | ||
val %dirty = %changed | ||
if (%changed and 0b0110 == 0) { | ||
%dirty = %dirty or if (%composer.changedInstance(vm)) 0b0100 else 0b0010 | ||
} | ||
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) { | ||
if (isTraceInProgress()) { | ||
traceEventStart(<>, %dirty, -1, <>) | ||
} | ||
Dialog(slotIfNotNull(vm.text) { it: String, %composer: Composer?, %changed: Int -> | ||
%composer.startReplaceGroup(<>) | ||
Button(<block>{ | ||
val tmp0 = vm | ||
%composer.cache(%composer.changedInstance(tmp0)) { | ||
tmp0::onClickyClicky | ||
} | ||
}, %composer, 0) | ||
%composer.endReplaceGroup() | ||
}, %composer, 0) | ||
if (isTraceInProgress()) { | ||
traceEventEnd() | ||
} | ||
} else { | ||
%composer.skipToGroupEnd() | ||
} | ||
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int -> | ||
Scratch(vm, %composer, updateChangedFlags(%changed or 0b0001)) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ppingModeTransformTests/unstableCrossinline[useFir = false, intrinsicRemember = true].txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Source | ||
// ------------------------------------------ | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.runtime.ReadOnlyComposable | ||
|
||
|
||
@Composable fun Scratch(vm: MyUnstableViewModel) { | ||
Dialog( | ||
content = slotIfNotNull(vm.text) { | ||
Button( | ||
onClick = vm::onClickyClicky | ||
) | ||
} | ||
) | ||
} | ||
|
||
// | ||
// Transformed IR | ||
// ------------------------------------------ | ||
|
||
@Composable | ||
fun Scratch(vm: MyUnstableViewModel, %composer: Composer?, %changed: Int) { | ||
%composer = %composer.startRestartGroup(<>) | ||
val %dirty = %changed | ||
if (%changed and 0b0110 == 0) { | ||
%dirty = %dirty or if (%composer.changedInstance(vm)) 0b0100 else 0b0010 | ||
} | ||
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) { | ||
if (isTraceInProgress()) { | ||
traceEventStart(<>, %dirty, -1, <>) | ||
} | ||
Dialog(slotIfNotNull(vm.text) { it: String, %composer: Composer?, %changed: Int -> | ||
%composer.startReplaceGroup(<>) | ||
Button(<block>{ | ||
val tmp0 = vm | ||
%composer.cache(%composer.changedInstance(tmp0)) { | ||
tmp0::onClickyClicky | ||
} | ||
}, %composer, 0) | ||
%composer.endReplaceGroup() | ||
}, %composer, 0) | ||
if (isTraceInProgress()) { | ||
traceEventEnd() | ||
} | ||
} else { | ||
%composer.skipToGroupEnd() | ||
} | ||
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int -> | ||
Scratch(vm, %composer, updateChangedFlags(%changed or 0b0001)) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ppingModeTransformTests/unstableCrossinline[useFir = true, intrinsicRemember = false].txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Source | ||
// ------------------------------------------ | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.runtime.ReadOnlyComposable | ||
|
||
|
||
@Composable fun Scratch(vm: MyUnstableViewModel) { | ||
Dialog( | ||
content = slotIfNotNull(vm.text) { | ||
Button( | ||
onClick = vm::onClickyClicky | ||
) | ||
} | ||
) | ||
} | ||
|
||
// | ||
// Transformed IR | ||
// ------------------------------------------ | ||
|
||
@Composable | ||
fun Scratch(vm: MyUnstableViewModel, %composer: Composer?, %changed: Int) { | ||
%composer = %composer.startRestartGroup(<>) | ||
val %dirty = %changed | ||
if (%changed and 0b0110 == 0) { | ||
%dirty = %dirty or if (%composer.changedInstance(vm)) 0b0100 else 0b0010 | ||
} | ||
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) { | ||
if (isTraceInProgress()) { | ||
traceEventStart(<>, %dirty, -1, <>) | ||
} | ||
Dialog(slotIfNotNull(vm.text) { it: String, %composer: Composer?, %changed: Int -> | ||
%composer.startReplaceGroup(<>) | ||
Button(<block>{ | ||
val tmp0 = vm | ||
%composer.cache(%composer.changedInstance(tmp0)) { | ||
tmp0::onClickyClicky | ||
} | ||
}, %composer, 0) | ||
%composer.endReplaceGroup() | ||
}, %composer, 0) | ||
if (isTraceInProgress()) { | ||
traceEventEnd() | ||
} | ||
} else { | ||
%composer.skipToGroupEnd() | ||
} | ||
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int -> | ||
Scratch(vm, %composer, updateChangedFlags(%changed or 0b0001)) | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
...ippingModeTransformTests/unstableCrossinline[useFir = true, intrinsicRemember = true].txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Source | ||
// ------------------------------------------ | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.NonRestartableComposable | ||
import androidx.compose.runtime.ReadOnlyComposable | ||
|
||
|
||
@Composable fun Scratch(vm: MyUnstableViewModel) { | ||
Dialog( | ||
content = slotIfNotNull(vm.text) { | ||
Button( | ||
onClick = vm::onClickyClicky | ||
) | ||
} | ||
) | ||
} | ||
|
||
// | ||
// Transformed IR | ||
// ------------------------------------------ | ||
|
||
@Composable | ||
fun Scratch(vm: MyUnstableViewModel, %composer: Composer?, %changed: Int) { | ||
%composer = %composer.startRestartGroup(<>) | ||
val %dirty = %changed | ||
if (%changed and 0b0110 == 0) { | ||
%dirty = %dirty or if (%composer.changedInstance(vm)) 0b0100 else 0b0010 | ||
} | ||
if (%dirty and 0b0011 != 0b0010 || !%composer.skipping) { | ||
if (isTraceInProgress()) { | ||
traceEventStart(<>, %dirty, -1, <>) | ||
} | ||
Dialog(slotIfNotNull(vm.text) { it: String, %composer: Composer?, %changed: Int -> | ||
%composer.startReplaceGroup(<>) | ||
Button(<block>{ | ||
val tmp0 = vm | ||
%composer.cache(%composer.changedInstance(tmp0)) { | ||
tmp0::onClickyClicky | ||
} | ||
}, %composer, 0) | ||
%composer.endReplaceGroup() | ||
}, %composer, 0) | ||
if (isTraceInProgress()) { | ||
traceEventEnd() | ||
} | ||
} else { | ||
%composer.skipToGroupEnd() | ||
} | ||
%composer.endRestartGroup()?.updateScope { %composer: Composer?, %force: Int -> | ||
Scratch(vm, %composer, updateChangedFlags(%changed or 0b0001)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters