Repository navigation
Conversation
added 3 commits
October 4, 2026 07:18
…tants it evaluates where they decide (#2043, D65 phase 5) Codegen still derives two kinds of fact Sema owns from the AST: the type of a type node (resolve_type, type_expr_to_sema_type) and the value of a constant string expression (try_eval_const_string). Each outermost call outside verification is now a counted decision, with its first site; a resolution run by verify_ast_type (the struct-field and sizeof verifications) is verification and is not counted. audit_ast_derivations fails while any kind is nonzero. This commit is the red half: the conversions follow.
… owner and its name are Sema's records (#2043, D65 phase 5) Codegen resolved AST type nodes and evaluated constant strings itself. Each site now reads Sema's record; the AST resolution runs only as verification under analysis (verify_ast_type, counted per mode-provenance site): - extern fn parameter/return types: Sema's extern signature (a missing one is an error, no AST fallback); extern var: extern_var_type_ids (new); type alias target: type_decl_tids; discriminant repr: disc_repr_types; dyn trait method parameter: Sema's frozen resolution, as its return was. - transmute target and asm output types: note_type_level_arg records them per specialization beside sizeof/alignof; body_type_node_llvm reads them. - a value-ref parameter Sema's MIR local does not type: Sema's signature. - an impl's trait type arguments for default methods: impl_trait_arg_type_ids. - a generic enum template's payload naming its parameter: no LLVM type. - string constants (globals, const pointers, const locals): Sema's const_string_value (literals, concatenations, immutable lets, embed_file contents Sema already read); codegen's evaluator and its second embed read are deleted. comptime_decode_string_escapes builds with one buffer. - declare_function_at_inner takes the method's short name from method_name_syms (new), not text after `.`; the two MIR prologues take the owner from method_owner_keys and no longer infer it from a `self: Type` parameter (a struct `self` with no recorded owner is an audit:codegen violation). - dead code removed: resolve_trait_method_type_for_impl*, local_fn_sigs and build_fn_type_from_ast (written, never read). stage1 builds on Linux (dev rc=0). Audit numbers follow.
…res one opaque type, not two (#2043) audit:codegen's new "declaration type node LLVM type" lane failed 8 of test/contract/ok_*.w under audit:all (contract-view-tests red), e.g. ok_parent_borrow: struct_sqlite3 subject 0: owner=struct `sqlite3` derived=struct `sqlite3$321` Sema's alias target and codegen's AST resolution of the same node were different types. The exact line: ci_translate_typedef's forward-record arm (src/CImport.w, `if not ci_record_definition_exists`) emitted `type sqlite3 = opaque` although ci_translate_struct had already emitted it for the struct's forward declaration. The translated module read type sqlite3 = opaque (tid 319, decl 3053) type struct_sqlite3 = sqlite3 (alias, resolved when only 319 existed) type sqlite3 = opaque (tid 321, decl 3055) so Sema held two types named sqlite3 in one module: struct_sqlite3 was the first, the name `sqlite3` the second, and codegen's #1446 split-name logic gave the second its own LLVM struct `sqlite3$321`. Neither side's resolution was wrong; the duplicate declaration was. The typedef arm now returns nothing when the type name is already emitted. Emitted code: before this stack codegen mapped the alias to the frozen resolution (`sqlite3$321`), now to Sema's (`sqlite3`); with the fix there is one type. Both are opaque and only ever behind `ptr`, so no IR differs. verify_ast_type's finding now names both LLVM types and the node (it printed two addresses). Red before (stage1 at 4b375f0, Linux): analyze behav_2043_c_import_typedef_struct_twin_one_type.w audit:all -> struct_node: owner=struct `node` derived=struct `node$321`, violations=1 Green after: violations=0 on it and on all 9 test/contract/ok_*.w. The test is also an audit:all case of deep-debug-tool-tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack created with GitHub Stacks CLI • Give Feedback 💬