Skip to content

fix(solid_generator): doc-comment .value rewrite + effect materialization lint (dev.9) - #115

Merged
nank1ro merged 1 commit into
mainfrom
fix/generator-doccomment-and-effect-materialization
Aug 29, 2026
Merged

nank1ro merged 1 commit into
mainfrom
fix/generator-doccomment-and-effect-materialization

Conversation

@nank1ro

@nank1ro nank1ro commented Aug 29, 2026

Copy link
Copy Markdown
Owner

Two generator quirks surfaced while building an app on dev.8.

Quirk A — doc-comment references get .value

A documentation-comment reference to a reactive field (/// … [count] …) was rewritten to [count.value] — an invalid reference that trips comment_references. _ValueRewriteVisitor now skips Comment subtrees (comment references resolve as declarations, not runtime reads), so the doc comment survives untouched while the member body still gets its .value append.

Quirk B — @SolidEffect trips unnecessary_statements

@SolidEffect lowered to late final <name> = Effect(...) plus a bare <name>; "touch" statement (in the synthesized constructor / initState) to force the lazy initializer. That bare statement trips unnecessary_statements in the generated output. It now lowers to a declared late final Effect <name>; field plus an assignment <name> = Effect(...) at the materialization site — lint-clean, and the canonical flutter_solidart idiom. The field stays late final because the closure reads sibling instance fields (a non-late initializer can't). Behaviour is unchanged: same closure, same materialization timing, same reverse-dispose order.

Tests

  • New goldens: doc_comment_reference_preserved, two_effects_ordering (locks multi-effect declaration + assignment ordering).
  • 15 effect goldens regenerated to the declare+assign shape.
  • Full suite 368/368 green (incl. idempotency), dart analyze lib clean.

Reviewed by 2 adversarial reviewers (0 bugs). Bumps solid_generator to 3.0.0-dev.9.

…tion lint

Two quirks:
- A doc-comment reference to a reactive field (/// [count]) is no longer
  rewritten to [count.value] — the value rewriter skips comment references.
- @SolidEffect lowers to a declared 'late final Effect <name>;' assigned at
  its materialization site instead of a bare '<name>;' touch, so generated
  output no longer trips unnecessary_statements. Same closure, same timing.

Adds doc_comment_reference_preserved + two_effects_ordering goldens.
Reviewed by 2 adversarial reviewers (0 bugs; 1 doc nit fixed, multi-effect
golden added, factory-redirect edge documented).
@nank1ro
nank1ro merged commit c727883 into main Aug 29, 2026
1 check failed
@nank1ro
nank1ro deleted the fix/generator-doccomment-and-effect-materialization branch August 29, 2026 02:33
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.

1 participant