Skip to content

Commit 4dcda1d

Browse files
romtsnclaude
andcommitted
ref: Combine Kt-marker rationale into one comment, drop R8 fixture header
Merge the restored "Kt suffix takes precedence" note back into the scan-loop comment, and rename the test block header from `ComposableSingletonsInlinedLambdaStackTrace` to a plain description — the sibling blocks in this file name upstream R8 retrace fixtures, which this case is not. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c1e0d61 commit 4dcda1d

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/utils.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ pub(crate) fn synthesize_source_file(
2222
let mut segments = last_segment.split('$');
2323
let base = segments.next()?;
2424

25-
// Compiler-generated wrappers (e.g. `ComposableSingletons$MainActivityKt`)
26-
// bury the `Kt` marker in an inner segment, so checking only `base` misses them.
25+
// Kt suffix is a strong Kotlin indicator and takes precedence over reference_file.
26+
// Compiler-generated wrappers (e.g. `ComposableSingletons$MainActivityKt`) bury the
27+
// marker in an inner segment, so we scan every `$`-segment, not just `base`.
2728
for segment in std::iter::once(base).chain(segments) {
2829
if let Some(kotlin_base) = segment.strip_suffix("Kt").filter(|s| !s.is_empty()) {
2930
return Some(format!("{}.kt", kotlin_base));

tests/r8-source-file-edge-cases.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn test_source_file_name_synthesize_stacktrace() {
118118
}
119119

120120
// =============================================================================
121-
// ComposableSingletonsInlinedLambdaStackTrace
121+
// ComposableSingletons inlined lambda
122122
//
123123
// When a lambda from a Compose `ComposableSingletons$FileKt` wrapper is inlined
124124
// through an R8 synthetic class, the outer class has no `sourceFile` metadata of
@@ -137,7 +137,8 @@ host.LocalKt$$ExternalSyntheticLambda0 -> a.b:
137137
fn test_composable_singletons_inlined_lambda_stacktrace() {
138138
let input = " at a.b.a(SourceFile:1)\n";
139139

140-
let expected = " at io.example.ComposableSingletons$MyScreenKt.lambda_1$lambda$2(MyScreen.kt:42)\n";
140+
let expected =
141+
" at io.example.ComposableSingletons$MyScreenKt.lambda_1$lambda$2(MyScreen.kt:42)\n";
141142

142143
assert_remap_stacktrace(
143144
COMPOSABLE_SINGLETONS_INLINED_LAMBDA_MAPPING,

0 commit comments

Comments
 (0)