Skip to content

Kotlin: nested block comments are not nested (lexical_family standard_block), commented code leaks into every family #9423

Backlog

Description

@squid-protocol

Found by the SOP-002 gap-cell decoy suite (protocol SOP-002-v1, epic #8863).

Construct: a nested block comment in Kotlin. The Kotlin language spec allows /* outer /* inner */ still comment */ to nest. kotlin.py declares "lexical_family": "standard_block" (flat C-style) even though its own comment says it "officially allows nested block comments", so the first */ closes the comment and the rest of the comment text is treated as code.

Snippet (every Kotlin family leaks; shown with immutability_locks):

/* outer
/* inner
*/
const val MAX = 10
*/

Expected: 0 immutability_locks hits (the const val line is inside the outer comment). Actual: 1 hit. The same holds for listeners (/* a /* b */ button.setOnClickListener { } */), explicit_casts (... obj as Customer ...) and api.

Likely fix: switch kotlin to the nested-aware lexical family used by rust/swift/scala (recursive_block, see Prism._strip_nested_comments).

Locked in tests/decoys/test_decoy_kotlin.py as xfail(strict=True).

Activity

  1. added
    bug
    on Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions