Skip to content

Conversation

@derekxu16
Copy link
Collaborator

In the past, if an internal type T was inferred to be stable when it was compiled in a compilation unit A, we would infer it to be stable when compiling a compilation unit B that uses the type. This caused failures in situations in which T was later made unstable by an edit and A was incrementally recompiled, but B was not. This change eliminates the possibility of such failures.

Test: ClassStabilityTransformTests.testInferredStabilityOfInternalTypesFromOtherCompilationUnits
Fixes: 427530633

@ShikaSD
Copy link
Collaborator

ShikaSD commented Dec 12, 2025

Could you also add a test to verify that the $dirty mask is generated correctly for internal calls without incremental compilation (should be always Runtime)? I expected it to be reflected in the existing tests, but I don't see it for some reason.

In the past, if an `internal` type `T` was inferred to be stable when it
was compiled in a compilation unit `A`, we would infer it to be stable
when compiling a compilation unit `B` that uses the type. This caused
failures in situations in which `T` was later made unstable by an edit and
`A` was incrementally recompiled, but `B` was not. This change eliminates
the possibility of such failures.

Test: ClassStabilityTransformTests.testInferredStabilityOfInternalTypesFromOtherCompilationUnits
Fixes: 427530633
@derekxu16 derekxu16 force-pushed the prr/derekx/fix-stability-inferencer branch from 278124e to eb9c553 Compare December 15, 2025 17:31
""",
"""
@Composable
internal fun CanSkip(foo: Foo = Foo()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure this test makes a lot of sense as is.

You want to check for codegen of parameters with the types of internal class FooStable(val value: Int) and internal class FooUnstable(var value: Int) instead of unstable class only.

The other thing I noticed is that unstable class produced changedInstance rather than changed call, which tells me that changedInstance is always generated for Runtime stability. Please file a bug for this.

Also no need to check default arguments, that does not affect stability here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants