Skip to content

Normalize Kotlin when exits across nested control flow - #17

Merged
asLody merged 2 commits into
asLody:mainfrom
LLeavesG:fix/kotlin-when-exit-normalization
Aug 14, 2026
Merged

Normalize Kotlin when exits across nested control flow#17
asLody merged 2 commits into
asLody:mainfrom
LLeavesG:fix/kotlin-when-exit-normalization

Conversation

@LLeavesG

Copy link
Copy Markdown
Contributor

Summary

  • remove terminal when exits from nested conditional and try paths without consuming breaks owned by nested loops
  • lower guarded non-terminal exits while preserving shared tails, method returns, and outer-loop continues
  • update the structured Kotlin expectation so a source switch break is not emitted as a Kotlin loop break

The two commits are ordered as one normalization pipeline: terminal exits first, then guarded and partial exits. Each commit independently passes formatting, the full library suite, and the end-to-end expected-output target.

Validation

  • cargo fmt --all -- --check
  • cargo check --workspace
  • cargo test -p dexdec --lib (475 passed)
  • 9 added regression scenarios run individually
  • all non-corpus dexdec integration targets passed
  • workspace tests excluding the baseline-flaky bridge package passed
  • node --test scripts/version.test.mjs
  • npm ci && npm run build
  • full-class forced-Kotlin decompilation on an anonymized production DEX shard completed with zero failures; base and candidate generated byte-identical source sets

Baseline comparisons

  • the external corpus target retains the same single pre-existing snapshot mismatch on base and candidate
  • the local bridge navigation test encountered the same temporary resource error on base and candidate; this change does not touch that package

Review notes

The implementation distinguishes exits owned by the current when from breaks and continues owned by nested or enclosing loops. Partial exits are lowered only when the transformed statement preserves the original completion behavior.

@asLody
asLody merged commit 61a5c8e into asLody:main Aug 14, 2026
1 check passed
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.

2 participants