Skip to content

Analyzer drops the add ... to CONST report when combined with other constant mutations #671

Description

@logbie

Found while converting syntax_test/test_constant_immutability.wfl into the asserted diagnostics fixture tests/fixtures/diagnostics/constant_immutability.wfl (repository hygiene migration).

Each mutation form (change, add, subtract, multiply, divide) is correctly rejected with Cannot modify constant ... when it appears alone. But when several mutations of the same constant appear in sequence, the analyzer emits only 4 reports for 5 mutations — the add 10 to MAX_SIZE report is the one dropped (verified by removing each line in turn: removing the add line still yields 4 reports; removing any other line yields 3).

Repro (exit code 3, count the reports):

store new constant MAX_SIZE as 100
change MAX_SIZE to 200
add 10 to MAX_SIZE
subtract 5 from MAX_SIZE
multiply MAX_SIZE by 2
divide MAX_SIZE by 2

tests/diagnostics_fixtures_test.rs::constant_mutation_is_rejected_for_every_mutation_form currently pins >= 4 reports with a comment pointing here; tighten it to >= 5 when this is fixed.

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions