Skip to content

ast: drop verifyGenerated, and give a macro-added field its location - #3694

Merged
borisbat merged 2 commits into
masterfrom
aleksisch/drop-verify-generated
Aug 11, 2026
Merged

ast: drop verifyGenerated, and give a macro-added field its location#3694
borisbat merged 2 commits into
masterfrom
aleksisch/drop-verify-generated

Conversation

@aleksisch

Copy link
Copy Markdown
Collaborator

Stacked on #3686 — base is aleksisch/remove_ast_validate, so this diff is just the two commits below.

verifyGenerated is gone

It verified nothing. Both of its guards were off:

#define VERIFY_GENERATED    0
#define LOG_GENERATED       0

so all 22 call sites were no-ops, and the only real check it ever held — CheckLineInfoVisitor, asserting that generated nodes carry a location — was already removed in #3686 because daslib/ast_verify does that job over every module, reporting instead of asserting in a configuration nobody enables.

Removed entirely: both overloads, the declarations in ast_generate.h, every call site, and the LOG_GENERATED define that only the deleted trace used.

What the removal exposed

#3686 had an overload that stamped a generated function body with the function's location. Deleting it regressed 423 reports in tutorials/language/43_interfaces.das and 152 in tutorials/macros/08_variant_macro.das — and all 575 came from one missing at:

add_structure_field (daslib/templates_boost.das) set name, _type and init but never at, so every field a macro adds was location-less. daslib/interfaces adds _interface_<Name> that way; generateStructureFinalizer then builds a per-field ExprDelete at fl.at (empty), infer passes that as the at for generatePointerFinalizer, and that generator stamps every node of the finalizer body with it.

The field now reports at the type it was built from, falling back to the structure it is added to — no signature change, so the other four callers and any external macro code benefit too.

So the stamping overload was masking a one-line bug in a published daslib helper, behind a function whose name said "verify" while it mutated. Deleting it was the right call.

Verification

  • --ast-verify clean on the files that regressed and on the macro-heavy set: 43_interfaces, 08_variant_macro, 29_functional, reflection, test_functional, optional_require, operators, decs, templates_boost, interfaces
  • tests/ interpreter suite: 13307 passed, 0 failed, 0 errors, 7 skipped — identical to before the change
  • lint clean on the changed .das
  • build green

Localizing the root took two throwaway fprintf probes (which of the four finalizer generators received an empty at, then which field produced it); both are removed.

🤖 Generated with Claude Code

add_structure_field set name, type and init but never at, so every field a macro
adds had none. Through the _interface_<Name> field that daslib/interfaces adds,
that emptied the per-field ExprDelete of the generated finalizer, which is the at
generatePointerFinalizer stamps its whole body with - one missing location became
575 location-less nodes across tutorials/language/43_interfaces.das and
tutorials/macros/08_variant_macro.das.

The field reports at the type it was built from, or at the structure it is added
to, so no caller has to change.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aleksisch
aleksisch force-pushed the aleksisch/drop-verify-generated branch from 9473ca9 to d6a81cf Compare August 11, 2026 13:51
It verified nothing: both of its guards, VERIFY_GENERATED and LOG_GENERATED, are
0, so all 22 call sites were no-ops - and the check it once held moved to
daslib/ast_verify, which reports over every module instead of asserting in a
build nobody enables.

Gone entirely: both overloads, the declarations, every call site, and the
LOG_GENERATED define that only the deleted trace used. The location invariant it
was meant to guard now holds because the generators set locations themselves -
see the add_structure_field fix in the previous commit for what the stamping
overload had been hiding.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@aleksisch
aleksisch force-pushed the aleksisch/drop-verify-generated branch from d6a81cf to 57ee1e2 Compare August 11, 2026 13:55
@aleksisch
aleksisch changed the base branch from aleksisch/remove_ast_validate to master August 11, 2026 13:56
@borisbat
borisbat merged commit 77da313 into master Aug 11, 2026
34 checks 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