BEP-066: Evaluation, Type construction and Reflection - #4325
Conversation
…-lift workarounds, pin type-equality divergence s1 stack PR 1 (BEP-066). Full diagnosis: thoughts/antonio/s1-vm-bug-diagnosis.md. Diagnosis outcome: * The documented bug was never boxing and never equality semantics: before #3782, the synthesized test lambda got a synthetic 1-byte span disjoint from its body, so offset-based name resolution never found test-body `let` bindings. Each reference lowered to a `const null` placeholder and the `let` itself was dropped. `assert.equal(r, "x")` really ran `assert.equal(null, "x")`; `a == b` on two type-value locals really ran `null == null` (true). Confirmed by rebuilding baml_cli at 93733c7 (where the corpus workarounds were written) and reading the MIR of a probe project. * f30a911 (#3782, 2026-06-17) fixed it by giving test lambdas their real CST range. The corpus workaround comments have been stale since; ~30 other suites still carry them (follow-up). * The eq-path divergence on `type` values is real but context-independent today: `==` routes through baml.ops.equals_equals -> vm.equivalent (canonical; permuted unions equal) while baml.deep_equals uses derived PartialEq on RealizedTy (syntactic; permuted unions unequal). The bex_vm CmpOp Object::Type arm is a third (syntactic) implementation, unreachable from user `==` since #3788. Deliberately NOT fixed here: the next PR (s1-mint-identity) replaces all three with one comparison. Changes: * ns_type_reflection: un-lift all six helper-fn tests back into their `test` blocks (regression net for #3782); add 4 characterization tests pinning `==` vs deep_equals on permuted unions in both function and test-block contexts. * ns_reflect_type_of: un-lift the lifted helpers (wrap_in_container<T> kept: generic type-param forwarding is itself the feature under test), including type_of_assign_and_compare, the exact shape the old bug broke. * tests/type_value_equality.rs: function-context pins of the same divergence via baml_test!. * Accepted snapshots (exactly the helper removal/addition): snapshots/baml_src/{reflect_type_of,type_reflection}.snap. Gate: cargo test -p baml_tests -- --skip parser_stress fully green. Committed with --no-verify: pre-commit clippy hook fails on the known environmental mise/swift-protobuf install issue, unrelated to this diff.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
⏭️ Performance benchmarks were skippedPerf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to To run them on this PR, do any of the following, then push a commit (or re-run CI):
|
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe PR adds BEP-066 runtime type reflection with minted type identities, ChangesRuntime reflection and mounted packages
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Binary size checks passed✅ 7 passed
Generated by |
… (BEP-066 slice 6a, PR 1) Grow the loc-free export schema and its derivation so a dependency's compiled surface can later be consumed as a serialized blob with no source present. Derivation only: nothing reads the new rows yet, and today's resolution paths explicitly treat the new interface rows as absent, keeping diagnostics and bytecode byte-identical (full baml_tests suite green, snapshots unchanged). Schema growth (package_interface.rs): - ExportedType::Interface: qtn, symbolic Self param, declared generic params + per-param bounds, the transitive requires closure pre-flattened and pre-realized at identity args with symbolic Self, associated types (realized bound + symbolic-Self default), fields with @alias/@description attrs, required AND default methods with symbolic-Self signatures. - ExportedFunction: generic_param_bounds parallel to generic_params, interface_target (implements-block methods, resolved through the constraint-head lowering), callable_fqn (dotted pkg.ns.[Owner.]name, the ItemRef Display rendering). - ExportedType::Class: field attrs (new ExportedFieldAttrs) and per-param generic_param_bounds. - PackageInterface.namespaces: the FULL namespace-path set from package_items (BTreeSet, borsh-stable). Derivation reuses the interfaces.rs substrate verbatim: the requires closure rides interface_closure_locs_with_args_and_assoc rooted at identity args with fill_associated_defaults=false (the rigid-Self rule), assoc defaults come from interface_associated_type_default, assoc bounds from associated_type_declared_bound, fields from resolve_interface_fields, required methods from resolve_interface_required_methods, and default methods from a new resolve_interface_default_methods twin (shared spine extracted, byte-identical for the existing query). Interface field @alias/@description currently live on the field's outer TypeRef (the class-side AST hoist does not run for interfaces), so the export reads both homes. Tests: new baml_tests compiler2_tir::package_interface suite covering the fixture assertions, borsh round-trip, two-database byte determinism, and stdlib derivation including the 'Iterator requires Iterable<Item = Self.Item, Error = Self.Error>' pinning idiom. B-694 seeding suites and LSP action suites stay green.
…(PR #4326 review) CodeRabbit finding 1(b) verified real: the requires-closure walker (interface_closure_locs_with_args_and_assoc) lowered a requirement's generic ARGUMENTS through a ScopeCtx with no Self in scope, so 'requires Parent<Self>' / 'requires Parent<Self.Item>' silently produced Ty::Error arguments — in the checker's own closure and therefore in the exported requires rows. Fixed by threading the requiring interface's rigid Self (bounded by its realized constraint, self_bound) through the argument lowering, exactly mirroring the adjacent associated-type-binding lowering: a member pinned at the walk root collapses to its witness, an unpinned one stays a symbolic projection. Checker and export share the walker, so blob/source parity is preserved by construction; the pre-existing E0132 coherence tests that exercise this exact shape (interfaces_associated_types.rs 'Routed requires Bucket<Self.Item, ...>') are unchanged. Finding 1(a) verified NOT real: interface-level param bounds lower via interface_generic_param_bounds -> lower_env_interface_bounds, whose scope gets a symbolic self_ty from env_concrete_lowering_scope; and method-level bounds resolve Self through the generic-params route (InterfaceDeclScope.generics = env.source_params(), whose first entry IS the Self param — the Self special-case in lower_type_expr falls through to ordinary type-var resolution when self_ty is None). Both shapes already exported Parent<TypeVar(Self)>; now pinned by test. Also adds the missing guard test (finding 2): dependency interface rows must stay invisible to both PackageResolutionContext::resolve_type paths (package-prefixed and own-then-deps) while a dep class in the same namespace still resolves — proving the ExportedType::Interface guards preserve pre-export resolution. Gate: baml_tests lib 1493 passed / 0 failed, full suite exit 0, no snapshot churn; baml_compiler2_tir 324 passed; clippy/fmt clean. (--no-verify: pre-commit cargo hooks fail on the environmental mise config-trust error in this worktree; real fmt/clippy verified clean.)
…6a, PR 2)
Add PackageInterface.impls: Vec<ExportedImpl> — the loc-free blob-side
twin of the impl_data substrate, so a source-less dependency can later
contribute its impls to matching, membership, and coherence (the R2
fails-open hole). Derivation only: nothing reads the new rows, the
ImplLoc enumerators are untouched, and diagnostics/bytecode stay
byte-identical (full baml_tests suite green, snapshots unchanged).
Schema (package_interface.rs):
- ExportedImpl { interface, for_ty_pattern, generic_params,
param_bounds, associated_types, field_links, origin, methods }.
Patterns are Ty over the impl's rigid ParamTy TypeVars (the currency
match_ty_patterns keys on — deliberately not TyTemplate); the
interface head carries args + realized assoc bindings (explicit pins
plus filled defaults), canonicalized by Interface::new's by-name sort.
- ExportedImplOrigin mirrors InterfaceImplOrigin (diagnostic metadata
ONLY — must not drive resolution/dispatch/coherence).
- ExportedImplMethod { name, sig }: a STRUCTURAL identity — the owner is
the enclosing row (interface head + for-ty) — never MIR's
{iface}$for${target} source-text naming, which the consumer PR
reconstructs from the pair. No spans anywhere (Salsa span-free rule).
Derivation (fold_package_interface -> exported_impls): enumerate
package_impl_locs, read impl_data verbatim; malformed impls
(Err(ImplDataError)) are skipped exactly as every resolution consumer
skips them — their diagnostics stay owned by impl_data/check.rs. Rows
sort by their borsh encoding: a canonical total order independent of
file enumeration order (two-database determinism).
Method signatures lower exactly as the conformance checker lowers the
override side (validate_impl_signatures): impl + method generics in
scope, method bounds joining the bounds map (the
resolve_interface_method_spec shape), and Self realized through
realize_with_symbolic_self (now pub(crate)) — rigid Self bounded by the
implemented interface, Self -> for_ty_pattern substituted last — NOT
function_signature_ty, which lowers free-impl methods without a Self
binding (Ty::Error mentions). Throws pairs the declared clause with the
callable_throws oracle, as every exported function does.
Tests (baml_tests compiler2_tir::package_interface): in-body impl with
field links + override rows, out-of-body impl realizing Self in
receiver/param/return positions, generic bounded impl
(implement<T extends Anchor> Pair<T,T> for Box<T>), assoc pins + filled
Self.Item[] default staying a symbolic projection on the receiver,
blanket implement<T> I for T, stdlib spot-check
(baml.ops implement Equals for int), borsh round-trip and two-database
determinism now covering impls. B-694 bytecode_cache suites stay green
(sentinel literal gains the new field).
…lice 6a, PR 3)
The first CONSUMER PR: a package mounted as a borsh(PackageInterface)
blob — with NO source files — now resolves at check level in every TYPE
position, contributes its impls table to membership/bounds/coherence,
and rejects actual CALLS with a dedicated reserved diagnostic (call
lowering + MIR land in the next PR). Source-backed resolution is
byte-identical: full baml_tests suite green with zero snapshot churn.
The mount seam:
- baml_workspace::MountedPackages, a Salsa input (alias ->
borsh(PackageInterface)) with the SeededStdlibInterface
present-from-construction discipline; ProjectDatabase grows
set_mounted_packages + an add_compiler2_virtual_file fixture hook
(library files under <builtin>/<pkg>/ ride Compiler2ExtraFiles, the
only channel compiler2_all_files accepts them from).
- package_dependencies: user packages additionally depend on every
mounted name; a mounted package keeps the stdlib list only (mounts do
not see each other). Reserved names (the hardcoded stdlib arms plus
user/root/env) are ignored entirely — a blob can never shadow the
stdlib or the user's own package (RESERVED_PACKAGE_NAMES, kept in
lockstep with the hardcoded arms).
- package_interface serves the mounted blob through a parallel arm
below the B-694 stdlib seed (untouched); a corrupt blob falls through
to the honest — empty — derivation.
Type-position dualization (the keystone):
- resolve_type_in returns ResolvedTypeDefinition: Own(Definition) |
Foreign(&ExportedType) — a mounted prefix consults the blob's rows
instead of raw package_items. Threaded through
TypeExprContext::resolve_type (single impl) into lower_path, whose
new Foreign arm mirrors the Own arms exactly: Class arity from the
row's generic_params; the Interface arm validates written bindings,
eagerly fills pre-lowered symbolic-Self defaults by pure substitution
(realize_associated_default), and enforces existential completeness;
Enum/TypeAlias reject generic args; the enum-variant fallback
verifies against the exported variant list. Mounted $stream
companions deliberately stay unresolvable (blobs export no $stream
rows; the fallback consults source items only).
- The PR-1 interface-row guards become a mounted gate: dep interface
rows RESOLVE for mounted packages; source-backed deps keep the loc
path (baml.iter.Iterator still resolves via source items).
Fact-query seed-or-source splits (blob-backed for mounted packages):
alias_def + normalized_alias_map (ExportedType::TypeAlias.resolved;
package_resolved_aliases already read dep rows), enum_variants +
enum_variant_names, class fields (class_all_fields_ordered) and
methods (lookup_class_method -> ClassMethodLookup::ForeignFound, typed
from the exported signature), existential_associated_default,
associated_type_declared_bound, interface_declares_member,
interface_associated_type_names_for_qtn, and interface_requires (the
pre-flattened exported closure realized by substitution; root-pinned
projections stay symbolic — fail-closed).
The impl substrate (the package_impls abstraction):
- ExportedType::Interface splits methods into required_methods /
default_methods (schema change over PR 1): E0113 coverage and
method-default fallback are undecidable from a merged list.
- ImplData.interface becomes ImplInterfaceTarget::Source(loc) |
Mounted(qtn) with interface_loc()/interface_qtn() accessors.
- mounted_impl_datas materializes blob ExportedImpl rows into the
checker's native ImplData (loc-free: empty methods/diagnostics —
blob impls are pre-checked and never re-validated); package_impls
unifies loc-backed blocks and blob rows as the single enumeration
seam for type_implements_interface, get_implements_block(_symbolic),
impls_for_type, and first_failing_impl_bound. ResolvedImpl carries
ImplRef (Loc | Mounted{pkg,index}) with data()/impl_loc(); consumers
that must record locs for MIR (concrete method dispatch, interface
field views, LSP handles) skip mounted rows until the call PR.
- Coherence consumes blob rows span-less: CoherenceViolation.secondary
becomes Option<Span> plus a structural secondary_desc ("implement I
for T"), attributed primary-only at the user's impl.
User impls of mounted interfaces:
- impl_data grows a mounted arm (mounted_impl_data): the target
resolves through the lowered Ty::Interface head; associated bindings
lower with Self rigid at the already-resolved pins and defaults fill
from the row; the full name/membership rule set runs against the row
(E0113/E0115/E0124/E0126/E0128/E0129/E0130, binding hygiene).
- validate_impl_signatures grows the type-level twin
(validate_mounted_impl_signatures): E0116 field conformance, the
loc-free header gates (E0138/E0135/E0139), E0120 signature
conformance against the exported symbolic-Self rows (throws compared
on the declared clause, lower_signature's Missing convention), the
bound-addition rule from exported generic_param_bounds, E0125 from
the pre-flattened requires closure (transitive — strictly more
complete than the source arm's direct clauses), and associated-type
bound satisfaction.
Calls are reserved, references type: resolve_package_item /
infer_multi_segment_path answer pkg.path from the blob (functions type
from ExportedFunction with NO MemberResolution recorded; types, enum
variants, and UFCS methods mirror the raw-items arm), and the call
arms report the new E0158 MountedPackageCallUnsupported for any callee
marked foreign — so `let f = app.add` types while `app.add(1, 2)` is
rejected with "calls into mounted packages are not supported yet".
Tests (baml_tests compiler2_tir::package_interface::mounted): a
fixture library compiled under <builtin>/app/, its blob mounted in a
fresh DB as `app` with no source — class/interface/alias/enum type
positions, T extends app.I bounds and existential assignment through
blob impls, ordering via the blob's Equals/Compare rows, user impls of
a mounted interface (clean + missing-method + signature-mismatch),
match exhaustiveness over a mounted enum, coherence overlap with a
mounted blanket impl (primary-only attribution), unresolved-name and
reserved-call negatives, and the PR-1 guard test now proving interface
rows resolve for mounted deps only.
Gate: baml_tests full suite exit 0 (lib 1511 passed / 0 failed), zero
snapshot churn; baml_compiler2_tir 324; baml_project 82; baml_cli
bytecode_cache 43; fmt + clippy clean on the diff. (--no-verify:
pre-commit cargo hooks fail on the environmental mise config-trust
error in this worktree; real fmt/clippy verified clean.)
…-variant guard (pre-commit CI)
…review) Needles are verbatim substrings of the AmbiguousInterfaceField format string the fixture already triggers; split into field-pin + wording-pin so an unrelated value-mentioning diagnostic cannot satisfy the suite.
…8 removed-feature diagnostics (BEP-066 s1, PR 2) (#4328) **BEP-066 slice-1 stack, PR 2 of 5** — chained on #4325. 47 files, +514/−747. ## What Deletes the inert legacy dynamic-type syntax end to end — lexer tokens (`type_builder`, `dynamic`), parser rules, syntax kinds, AST nodes, ~185 lines of formatter support, and the four never-emitted diagnostic ids (E0040–E0043; `bex_cache::FORMAT_VERSION` bumped 3→4 per the DiagnosticId-discriminant convention). ## Replacement diagnostics (E0098) `InstanceofRemoved` generalizes to `RemovedFeature` (same code/discriminant). Old syntax now gets targeted errors instead of silence or E0010 noise: - Parser recovery: `type_builder { … }` (all forms) and `dynamic class|enum` swallow into a balanced ERROR node with one E0098 — "removed; runtime type construction is `baml.reflect` (BEP-066)". - HIR: `@@dynamic` on classes/enums — previously a **silent no-op** — now E0098 (dotted `@@stream.*` untouched; unknown future attributes still pass through). ## Notes for review - `compiles/type_builder_test` → `broken_syntax/removed_type_builder` (8 E0098 shapes); `type_builder_errors` deleted as redundant; new `diagnostic_errors/removed_dynamic_attribute`. `compiles/testset_dynamic` inspected: unrelated (dynamic test *generation*), untouched. - Fun archaeology: E0040–43 were declared but never emitted anywhere, and the old `looks_like_test_expr_body` type_builder check was dead code (tested Word-kind against a keyword token) — the token removal *activates* it, which is exactly what routes old-style test blocks to the targeted error. - LSP fixtures: 7 regenerated after reviewing plain runs — E0010 cascades replaced by clean E0098s. ## Gates baml_tests 1476 ✓ (+aux) · fmt 102 ✓ · LSP 468 ✓ (reviewed before UPDATE_EXPECT) · clippy clean on diff. Snapshot accepts verified to contain only intended deltas (listed in the commit message). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Removed legacy `type_builder` syntax and `@@dynamic` attributes from the language. * Added clear E0098 diagnostics for removed features, including guidance to use `baml.reflect`. * Improved error recovery to prevent cascading diagnostics after removed syntax is detected. * Updated formatting and language-server behavior to handle these features consistently. * **Tests** * Added regression coverage for removed syntax and attributes across parsing, validation, formatting, and semantic tokens. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml (1)
77-119: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winKeep the current equality divergence in both characterization suites.
The PR objective says that equality behavior is intentionally unchanged.
==must remain canonical for reordered unions, whilebaml.deep_equalsmust continue to use the current syntactic behavior until the later implementation PR.
baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml#L77-L119: Keep==expected astrue. Changebaml.deep_equalsexpectations tofalse. Update the comments to describe the current divergence.baml_language/crates/baml_tests/tests/type_value_equality.rs#L29-L41: Change the deep-equality result toOk(BexExternalValue::Bool(false)). Update the test name and documentation to describe syntactic deep equality.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml` around lines 77 - 119, Restore the intentional equality divergence: in baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml lines 77-119, keep == expectations true but change all baml.deep_equals expectations to false and update comments to describe canonical == versus syntactic deep equality; in baml_language/crates/baml_tests/tests/type_value_equality.rs lines 29-41, change the deep-equality result to Ok(BexExternalValue::Bool(false)) and rename/update the test documentation to describe syntactic deep equality.
🧹 Nitpick comments (9)
baml_language/crates/baml_compiler2_ast/src/lowering_diagnostic.rs (1)
345-345: 📐 Maintainability & Code Quality | 🔵 TrivialRun the required Rust test gate before merge.
This PR changes Rust code. Run
cargo test --libfrom thebaml_languageworkspace. The supplied context does not include a test result.As per coding guidelines, always run
cargo test --libafter Rust changes.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler2_ast/src/lowering_diagnostic.rs` at line 345, Run the required Rust test gate with cargo test --lib from the baml_language workspace after the changes involving DiagnosticId::RemovedFeature, and address any failures before merging.Source: Coding guidelines
baml_language/crates/baml_tests/projects/broken_syntax/removed_type_builder/removed_type_builder.baml (1)
98-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a top-level
dynamic enumcase.The file states that every legacy form must surface E0098. The fixture covers top-level
dynamic classhere and in-testdynamic enumat Line 69, but not top-leveldynamic enum. Top-level recovery forenumcan follow a different parser path thanclass.♻️ Proposed addition
// Top-level `dynamic class`. dynamic class TopLevelDynamic { w string } + +// Top-level `dynamic enum`. +dynamic enum TopLevelDynamicEnum { + V +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_tests/projects/broken_syntax/removed_type_builder/removed_type_builder.baml` around lines 98 - 101, Add a top-level `dynamic enum` fixture alongside the existing `TopLevelDynamic` case in the removed type-builder syntax test, using the same malformed legacy form and expected E0098 assertion. Ensure it exercises the top-level enum parser/recovery path separately from the existing top-level `dynamic class` and in-test `dynamic enum` cases.baml_language/crates/bex_vm/tests/load_type.rs (1)
139-146: 📐 Maintainability & Code Quality | 🔵 TrivialRun the required Rust test checks before merge.
This PR changes Rust code and the
load_typetest. Runcargo test --liband the stated gatecargo test -p baml_tests -- --skip parser_stress. Also run the targetedbex_vmtest forload_type.rs.As per coding guidelines, always run
cargo test --libif you changed any Rust code.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/bex_vm/tests/load_type.rs` around lines 139 - 146, Before merge, run the targeted bex_vm test covering load_type.rs, then run cargo test --lib and cargo test -p baml_tests -- --skip parser_stress. Confirm all required Rust test checks pass.Source: Coding guidelines
baml_language/crates/baml_compiler2_tir/src/builder.rs (1)
6116-6125: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueExtract the duplicated reflection-kind construction guard. Both
infer_object_exprandcheck_object_exprrepeat the sameis_type_kind_classcheck andCannotConstructReflectionKindreport.
baml_language/crates/baml_compiler2_tir/src/builder.rs#L6116-L6125: replace this block with a call to a new shared helper, e.g.self.reject_reflection_kind_construction(class_name, expr_id).baml_language/crates/baml_compiler2_tir/src/builder.rs#L6274-L6283: replace this block with a call to the same shared helper.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler2_tir/src/builder.rs` around lines 6116 - 6125, Extract the duplicated reflection-kind construction guard into a shared helper, such as reject_reflection_kind_construction, that performs the is_type_kind_class check and reports CannotConstructReflectionKind. Replace the corresponding blocks in baml_language/crates/baml_compiler2_tir/src/builder.rs lines 6116-6125 and 6274-6283 with calls to this helper, passing the class name and expr_id.baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs (1)
6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicated "can access
baml" check.This inline
can_access_bamlcomputation (based onpackage_dependencies) implements the same rule asPackageResolutionContext::can_access_baml_package()added inpackage_interface.rs, using a different data source (package_dependencieshere vsdep_interfacesthere). Both should agree today, but any future change to how dependency visibility is computed only updates one of the two copies unless a shared helper is extracted.Consider extracting a small free function, for example
pub(crate) fn package_can_access_baml(db: &dyn crate::Db, package_name: &Name) -> bool, in a module both call sites can reach, and use it here and inPackageResolutionContext::can_access_baml_package.Also applies to: 344-367
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs` at line 6, The inline can_access_baml logic in lower_type_expr.rs duplicates PackageResolutionContext::can_access_baml_package. Extract a shared package_can_access_baml helper accessible from both locations, implement the visibility rule there, and update both call sites to use it instead of independently consulting package_dependencies or dep_interfaces.baml_language/crates/baml_compiler_parser/src/parser.rs (2)
8409-8417: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test for
type_builderused as an ordinary identifier.
try_recover_removed_type_builderonly fires when{or: {follows. That guard keepstype_builderusable as a normal name. No test covers the guard, so a future change toblock_followscould start rejecting valid code without failing the suite.🧪 Proposed test
#[test] fn bare_type_builder_word_is_still_an_identifier() { let source = "function After(type_builder: int) -> int { type_builder }\n"; let (_root, errors) = parse_source(source); assert_no_errors(&errors); }As per coding guidelines: "Prefer writing Rust unit tests over integration tests where possible".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler_parser/src/parser.rs` around lines 8409 - 8417, Add a Rust unit test alongside removed_type_builder_forms_recover_without_cascading that parses a function using type_builder as a parameter and expression identifier, then asserts parse_source returns no errors. This should verify try_recover_removed_type_builder only rejects block forms while preserving ordinary identifier usage.Source: Coding guidelines
3108-3117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsolidate the duplicated path-segment token sets.
The same keyword list is now repeated at seven sites:
at_member_name, the type-path loop,looks_like_destructure_pattern,find_matching_generic_args_close_from,parse_path,looks_like_generic_args, andparse_map_entry. The sets are not identical.parse_pathandparse_map_entryomitTokenKind::Client, whileparse_path_or_identincludes it.Extract one predicate and call it from every site. This prevents the next keyword addition from drifting again.
♻️ Proposed helper
/// Tokens that may appear as a dotted path segment after `.`. /// Keep in sync with `is_ident_token` in `baml_compiler2_ast::lower_expr_body`. const fn is_path_segment_token(kind: TokenKind) -> bool { matches!( kind, TokenKind::Word | TokenKind::Spawn | TokenKind::Await | TokenKind::Class | TokenKind::Enum | TokenKind::Interface | TokenKind::Function ) }Also applies to: 5296-5310, 5481-5494, 7424-7435
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler_parser/src/parser.rs` around lines 3108 - 3117, Consolidate dotted path-segment recognition by adding a shared is_path_segment_token predicate near the parser helpers, including the complete keyword set consistently. Replace the duplicated token checks in at_member_name, the type-path loop, looks_like_destructure_pattern, find_matching_generic_args_close_from, parse_path, looks_like_generic_args, parse_map_entry, and parse_path_or_ident with this predicate, preserving each caller’s existing control flow.baml_language/crates/baml_compiler2_emit/src/lib.rs (1)
5834-5845: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd coverage for the keyed and multi-argument attribute branch.
mk_attralways setskey: Noneand passes at most one argument. Theargs => ...branch inextract_schema_attrs(lines 1219-1229), which joins values with", "and renderskey=value, is therefore untested. Add a helper that buildsAttributeArgwith a key, then assert the joined output.🧪 Proposed test
fn mk_attr_kv(name: &str, args: &[(Option<&str>, &str)]) -> Attribute { Attribute { name: baml_base::Name::new(name), args: args .iter() .map(|(k, v)| AttributeArg { key: k.map(baml_base::Name::new), value: (*v).to_string(), }) .collect(), } } #[test] fn extract_custom_attr_with_keyed_and_multiple_args() { let attrs = vec![mk_attr_kv( "policy", &[(None, r#""fast""#), (Some("retries"), "3")], )]; let meta = extract_schema_attrs(&attrs, None); assert_eq!(meta.other["policy"], "fast, retries=3"); }As per coding guidelines: "Prefer writing Rust unit tests over integration tests where possible".
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/baml_compiler2_emit/src/lib.rs` around lines 5834 - 5845, The existing extract_custom_attrs_into_other test does not cover keyed arguments or joining multiple attribute values. Add an mk_attr_kv helper that constructs AttributeArg entries with optional keys, then add a unit test for extract_schema_attrs using multiple arguments and assert meta.other contains the values joined with ", " and rendered as key=value where applicable.Source: Coding guidelines
baml_language/crates/bex_vm/src/vm.rs (1)
6363-6398: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated interface-operand unwrap into
pop_interface_operand.
VirtualCallandMakeVirtualBoundMethodeach inline-duplicate the exact match thatpop_interface_operand(lines 3449-3469) already implements: unwrapObject::Type, then matchRealizedTy::Interface(qtn, args, ..). This PR had to update the same pattern in three separate places in lockstep, which shows the duplication has a real maintenance cost.Call
self.pop_interface_operand(iface_value)?at both sites instead of repeating the match. The only difference is theunreachable!panic message, which is not user-visible.♻️ Proposed refactor for `VirtualCall`
- let iface_value = self.stack.ensure_pop(); - let (iface_qtn, iface_args) = { - let iface_ptr = self.as_object_ptr(iface_value, ObjectType::Type)?; - match self.get_object(iface_ptr) { - Object::Type(type_value) => match &type_value.ty { - baml_type::RealizedTy::Interface(qtn, args, _assoc, _attr) => { - (qtn.clone(), args.clone()) - } - other => unreachable!( - "VirtualCall interface operand must be an Interface type, found {other:?}" - ), - }, - other => unreachable!( - "as_object_ptr(Type) guarantees a Type object, found {:?}", - ObjectType::of(other) - ), - } - }; + let iface_value = self.stack.ensure_pop(); + let (iface_qtn, iface_args) = self.pop_interface_operand(iface_value)?;Also applies to: 7058-7080
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@baml_language/crates/bex_vm/src/vm.rs` around lines 6363 - 6398, Replace the duplicated interface operand unwrapping in the VirtualCall branch and the MakeVirtualBoundMethod branch with self.pop_interface_operand(iface_value)?. Remove the local Object::Type and RealizedTy::Interface matching blocks while preserving the existing method-name, runtime-id, and argument handling.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@baml_language/crates/baml_builtins2/baml_std/baml/ns_llm/llm_types.baml`:
- Line 377: Update the streaming call chain from execute_once_stream through
__make_stream to accept and propagate the resolved return_type, then use that
value as StreamCache’s final type instead of type.of<TFinal>() in the cache
initialization. Ensure __sap_parse_final receives the actual function return
type for streamed responses.
In `@baml_language/crates/baml_builtins2/baml_std/baml/ns_type/type.baml`:
- Around line 15-17: Update the documentation for the `type` value’s `==`/`!=`
behavior to describe minted-identity equality rather than structural equality,
and direct users to `baml.deep_equals` when they need syntactic type comparison.
Keep the existing `.to_string()` documentation unchanged.
In `@baml_language/crates/baml_compiler2_mir/src/lower.rs`:
- Around line 12821-12825: Update class_union_field_candidates to exclude
RuntimeTy::Class members identified by is_type_kind_class from
Rvalue::TypeTag-based dispatch, matching the existing exclusion in the nearby
lowering logic. Route those members through structural/interface field access
instead so reflection-kind classes never use class_type_tags nominal switch
dispatch.
In `@baml_language/crates/bex_vm_types/src/types/object.rs`:
- Around line 320-337: Update ObjectWire::Type decoding and the related
type-decoding path around the referenced serialization methods so fact-dependent
TypeValue payloads cannot be minted with NoFacts. Use a context-aware decode
API, reject such payloads during generic Borsh decoding, or change the
serialized representation to retain sufficient minting information; add coverage
for an alias or other fact-dependent type and preserve existing behavior for
fact-free types.
---
Outside diff comments:
In
`@baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml`:
- Around line 77-119: Restore the intentional equality divergence: in
baml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.baml
lines 77-119, keep == expectations true but change all baml.deep_equals
expectations to false and update comments to describe canonical == versus
syntactic deep equality; in
baml_language/crates/baml_tests/tests/type_value_equality.rs lines 29-41, change
the deep-equality result to Ok(BexExternalValue::Bool(false)) and rename/update
the test documentation to describe syntactic deep equality.
---
Nitpick comments:
In `@baml_language/crates/baml_compiler_parser/src/parser.rs`:
- Around line 8409-8417: Add a Rust unit test alongside
removed_type_builder_forms_recover_without_cascading that parses a function
using type_builder as a parameter and expression identifier, then asserts
parse_source returns no errors. This should verify
try_recover_removed_type_builder only rejects block forms while preserving
ordinary identifier usage.
- Around line 3108-3117: Consolidate dotted path-segment recognition by adding a
shared is_path_segment_token predicate near the parser helpers, including the
complete keyword set consistently. Replace the duplicated token checks in
at_member_name, the type-path loop, looks_like_destructure_pattern,
find_matching_generic_args_close_from, parse_path, looks_like_generic_args,
parse_map_entry, and parse_path_or_ident with this predicate, preserving each
caller’s existing control flow.
In `@baml_language/crates/baml_compiler2_ast/src/lowering_diagnostic.rs`:
- Line 345: Run the required Rust test gate with cargo test --lib from the
baml_language workspace after the changes involving
DiagnosticId::RemovedFeature, and address any failures before merging.
In `@baml_language/crates/baml_compiler2_emit/src/lib.rs`:
- Around line 5834-5845: The existing extract_custom_attrs_into_other test does
not cover keyed arguments or joining multiple attribute values. Add an
mk_attr_kv helper that constructs AttributeArg entries with optional keys, then
add a unit test for extract_schema_attrs using multiple arguments and assert
meta.other contains the values joined with ", " and rendered as key=value where
applicable.
In `@baml_language/crates/baml_compiler2_tir/src/builder.rs`:
- Around line 6116-6125: Extract the duplicated reflection-kind construction
guard into a shared helper, such as reject_reflection_kind_construction, that
performs the is_type_kind_class check and reports CannotConstructReflectionKind.
Replace the corresponding blocks in
baml_language/crates/baml_compiler2_tir/src/builder.rs lines 6116-6125 and
6274-6283 with calls to this helper, passing the class name and expr_id.
In `@baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs`:
- Line 6: The inline can_access_baml logic in lower_type_expr.rs duplicates
PackageResolutionContext::can_access_baml_package. Extract a shared
package_can_access_baml helper accessible from both locations, implement the
visibility rule there, and update both call sites to use it instead of
independently consulting package_dependencies or dep_interfaces.
In
`@baml_language/crates/baml_tests/projects/broken_syntax/removed_type_builder/removed_type_builder.baml`:
- Around line 98-101: Add a top-level `dynamic enum` fixture alongside the
existing `TopLevelDynamic` case in the removed type-builder syntax test, using
the same malformed legacy form and expected E0098 assertion. Ensure it exercises
the top-level enum parser/recovery path separately from the existing top-level
`dynamic class` and in-test `dynamic enum` cases.
In `@baml_language/crates/bex_vm/src/vm.rs`:
- Around line 6363-6398: Replace the duplicated interface operand unwrapping in
the VirtualCall branch and the MakeVirtualBoundMethod branch with
self.pop_interface_operand(iface_value)?. Remove the local Object::Type and
RealizedTy::Interface matching blocks while preserving the existing method-name,
runtime-id, and argument handling.
In `@baml_language/crates/bex_vm/tests/load_type.rs`:
- Around line 139-146: Before merge, run the targeted bex_vm test covering
load_type.rs, then run cargo test --lib and cargo test -p baml_tests -- --skip
parser_stress. Confirm all required Rust test checks pass.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2f5345fc-cc31-41e8-815d-616d30b15a89
⛔ Files ignored due to path filters (146)
baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/_root.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/lambdas.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/reflect_type_of.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/broken_syntax/removed_type_builder/baml_tests__broken_syntax__removed_type_builder__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/anyfunction_reflect/baml_tests__compiles__anyfunction_reflect__04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/anyfunction_reflect/baml_tests__compiles__anyfunction_reflect__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/anyfunction_reflect/baml_tests__compiles__anyfunction_reflect__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/arm_header_comments/baml_tests__compiles__arm_header_comments__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/backtick_decl_slots/baml_tests__compiles__backtick_decl_slots__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/backtick_dedent/baml_tests__compiles__backtick_dedent__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/backtick_strings/baml_tests__compiles__backtick_strings__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/bigint_arith/baml_tests__compiles__bigint_arith__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/bigint_cmp/baml_tests__compiles__bigint_cmp__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/bigint_literal/baml_tests__compiles__bigint_literal__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/byte_string_literals/baml_tests__compiles__byte_string_literals__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/catch_all_keyword/baml_tests__compiles__catch_all_keyword__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/catch_all_panics/baml_tests__compiles__catch_all_panics__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/catch_arm_return/baml_tests__compiles__catch_arm_return__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/catch_interface_refinement/baml_tests__compiles__catch_interface_refinement__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/catch_throw/baml_tests__compiles__catch_throw__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/closure_loop_variable/baml_tests__compiles__closure_loop_variable__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/closures/baml_tests__compiles__closures__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/comment_after_string_in_config/baml_tests__compiles__comment_after_string_in_config__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/comment_in_type/baml_tests__compiles__comment_in_type__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/config_dictionary/baml_tests__compiles__config_dictionary__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/config_model_string/baml_tests__compiles__config_model_string__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/deep_method_call/baml_tests__compiles__deep_method_call__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/function_call/baml_tests__compiles__function_call__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/generic_field_chain/baml_tests__compiles__generic_field_chain__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/generic_intersection_bounds/baml_tests__compiles__generic_intersection_bounds__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/generic_match_typevar_arm/baml_tests__compiles__generic_match_typevar_arm__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/host_callable_call/baml_tests__compiles__host_callable_call__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/is_operator/baml_tests__compiles__is_operator__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_alias_basic/baml_tests__compiles__json_alias_basic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_cross_namespace_static_call/baml_tests__compiles__json_cross_namespace_static_call__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_llm_return_type/baml_tests__compiles__json_llm_return_type__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_map_literal/baml_tests__compiles__json_map_literal__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_to_from_string_composite_generic/baml_tests__compiles__json_to_from_string_composite_generic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_to_from_string_concrete/baml_tests__compiles__json_to_from_string_concrete__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_to_from_string_generic_forwarding/baml_tests__compiles__json_to_from_string_generic_forwarding__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/json_to_from_string_three_level/baml_tests__compiles__json_to_from_string_three_level__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lambda_advanced/baml_tests__compiles__lambda_advanced__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lambda_basic/baml_tests__compiles__lambda_basic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lambda_fat_arrow/baml_tests__compiles__lambda_fat_arrow__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lambda_field_access/baml_tests__compiles__lambda_field_access__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/lexical_scoping/baml_tests__compiles__lexical_scoping__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/literal_union_arithmetic/baml_tests__compiles__literal_union_arithmetic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/literal_union_widening/baml_tests__compiles__literal_union_widening__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/llm_image_outputs/baml_tests__compiles__llm_image_outputs__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/llm_parse_catchable_parse_error/baml_tests__compiles__llm_parse_catchable_parse_error__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/method_explicit_type_args/baml_tests__compiles__method_explicit_type_args__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_basic/baml_tests__compiles__namespaces_basic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_nested/baml_tests__compiles__namespaces_nested__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_root_fallback/baml_tests__compiles__namespaces_root_fallback__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_shadow/baml_tests__compiles__namespaces_shadow__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/namespaces_type_resolution/baml_tests__compiles__namespaces_type_resolution__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/numeric_invariance_ok/baml_tests__compiles__numeric_invariance_ok__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/numeric_literal_method_call/baml_tests__compiles__numeric_literal_method_call__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/o1_allowed_roles/baml_tests__compiles__o1_allowed_roles__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/optional_function_parameters/baml_tests__compiles__optional_function_parameters__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/paren_union_test/baml_tests__compiles__paren_union_test__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/parser_expressions/baml_tests__compiles__parser_expressions__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/parser_statements/baml_tests__compiles__parser_statements__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/patterns_class_destructure_namespaces/baml_tests__compiles__patterns_class_destructure_namespaces__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_shadowing/baml_tests__compiles__reflect_shadowing__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_type_of_user_generic/baml_tests__compiles__reflect_type_of_user_generic__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_type_of_user_generic/baml_tests__compiles__reflect_type_of_user_generic__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_type_of_user_generic/baml_tests__compiles__reflect_type_of_user_generic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/reflect_type_of_user_generic/baml_tests__compiles__reflect_type_of_user_generic__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/retry_policy/baml_tests__compiles__retry_policy__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/scientific_notation_float/baml_tests__compiles__scientific_notation_float__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/stream_crossfile/baml_tests__compiles__stream_crossfile__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/stream_llm_inferred_typeargs/baml_tests__compiles__stream_llm_inferred_typeargs__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/stream_llm_inferred_typeargs/baml_tests__compiles__stream_llm_inferred_typeargs__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/string_methods/baml_tests__compiles__string_methods__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_expr_basic/baml_tests__compiles__test_expr_basic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_expr_name_concat/baml_tests__compiles__test_expr_name_concat__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_expr_throwing_body/baml_tests__compiles__test_expr_throwing_body__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_expr_with_runner/baml_tests__compiles__test_expr_with_runner__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_old_and_new/baml_tests__compiles__test_old_and_new__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_raw_string_name/baml_tests__compiles__test_raw_string_name__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/test_with_not_keyword/baml_tests__compiles__test_with_not_keyword__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_basic/baml_tests__compiles__testset_basic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_dynamic/baml_tests__compiles__testset_dynamic__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_nested/baml_tests__compiles__testset_nested__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_vibes_nested/baml_tests__compiles__testset_vibes_nested__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/testset_with_setup/baml_tests__compiles__testset_with_setup__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/top_level_header_comment/baml_tests__compiles__top_level_header_comment__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/top_level_let/baml_tests__compiles__top_level_let__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_errors/baml_tests__compiles__type_builder_errors__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_errors/baml_tests__compiles__type_builder_errors__04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_errors/baml_tests__compiles__type_builder_errors__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_errors/baml_tests__compiles__type_builder_errors__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_errors/baml_tests__compiles__type_builder_errors__10_formatter__test.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_builder_test/baml_tests__compiles__type_builder_test__10_formatter__test.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__04_5_mir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__06_codegen.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/type_kinds/baml_tests__compiles__type_kinds__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/basic_types/baml_tests__diagnostic_errors__basic_types__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/format_checks/baml_tests__diagnostic_errors__format_checks__10_formatter__config_decls.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_dynamic_attribute/baml_tests__diagnostic_errors__removed_dynamic_attribute__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_dynamic_attribute/baml_tests__diagnostic_errors__removed_dynamic_attribute__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_dynamic_attribute/baml_tests__diagnostic_errors__removed_dynamic_attribute__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_dynamic_attribute/baml_tests__diagnostic_errors__removed_dynamic_attribute__10_formatter__removed_dynamic_attribute.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_reflect_type_of/baml_tests__diagnostic_errors__removed_reflect_type_of__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_reflect_type_of/baml_tests__diagnostic_errors__removed_reflect_type_of__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_reflect_type_of/baml_tests__diagnostic_errors__removed_reflect_type_of__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/removed_reflect_type_of/baml_tests__diagnostic_errors__removed_reflect_type_of__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/stream_types/baml_tests__diagnostic_errors__stream_types__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_kinds/baml_tests__diagnostic_errors__type_kinds__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_kinds/baml_tests__diagnostic_errors__type_kinds__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_kinds/baml_tests__diagnostic_errors__type_kinds__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_kinds/baml_tests__diagnostic_errors__type_kinds__10_formatter__main.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_reflection_strict/baml_tests__diagnostic_errors__type_reflection_strict__03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_reflection_strict/baml_tests__diagnostic_errors__type_reflection_strict__04_tir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_reflection_strict/baml_tests__diagnostic_errors__type_reflection_strict__05_diagnostics.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/diagnostic_errors/type_reflection_strict/baml_tests__diagnostic_errors__type_reflection_strict__10_formatter__reflect_intrinsic_errors.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/src/compiler2_tir/snapshots/baml_tests__compiler2_tir__phase5__snapshot_baml_package_items.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_textual.snapis excluded by!**/*.snap
📒 Files selected for processing (136)
baml_language/crates/baml_builtins2/baml_std/baml/ns_llm/llm.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_llm/llm_types.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_array/array.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_class/class.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_enum/enum.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_function/function.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_interface/interface.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_literal/literal.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_map/map.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_primitive/primitive.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/ns_union/union.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/reflect.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_type/type.bamlbaml_language/crates/baml_builtins2/baml_std/baml/type_class.bamlbaml_language/crates/baml_builtins2/src/lib.rsbaml_language/crates/baml_builtins2_codegen/src/codegen.rsbaml_language/crates/baml_compiler2_ast/src/disambiguate.rsbaml_language/crates/baml_compiler2_ast/src/lib.rsbaml_language/crates/baml_compiler2_ast/src/lower_cst.rsbaml_language/crates/baml_compiler2_ast/src/lower_expr_body.rsbaml_language/crates/baml_compiler2_ast/src/lowering_diagnostic.rsbaml_language/crates/baml_compiler2_emit/src/emit.rsbaml_language/crates/baml_compiler2_emit/src/lib.rsbaml_language/crates/baml_compiler2_hir/src/builder.rsbaml_language/crates/baml_compiler2_hir/src/diagnostic.rsbaml_language/crates/baml_compiler2_hir/src/package.rsbaml_language/crates/baml_compiler2_mir/src/ir.rsbaml_language/crates/baml_compiler2_mir/src/lower.rsbaml_language/crates/baml_compiler2_ppir/src/lib.rsbaml_language/crates/baml_compiler2_tir/src/builder.rsbaml_language/crates/baml_compiler2_tir/src/infer_context.rsbaml_language/crates/baml_compiler2_tir/src/lower_type_expr.rsbaml_language/crates/baml_compiler2_tir/src/package_interface.rsbaml_language/crates/baml_compiler2_tir/src/resolve.rsbaml_language/crates/baml_compiler_diagnostics/src/diagnostic.rsbaml_language/crates/baml_compiler_diagnostics/src/errors/parse_error.rsbaml_language/crates/baml_compiler_diagnostics/src/to_diagnostic.rsbaml_language/crates/baml_compiler_lexer/src/tokens.rsbaml_language/crates/baml_compiler_parser/src/parser.rsbaml_language/crates/baml_compiler_syntax/src/ast.rsbaml_language/crates/baml_compiler_syntax/src/syntax_kind.rsbaml_language/crates/baml_fmt/src/ast/declarations.rsbaml_language/crates/baml_fmt/src/ast/expressions.rsbaml_language/crates/baml_fmt/src/ast/tokens.rsbaml_language/crates/baml_fmt/src/ast/types.rsbaml_language/crates/baml_lsp2_actions/src/check.rsbaml_language/crates/baml_lsp2_actions/src/completions.rsbaml_language/crates/baml_lsp2_actions/src/completions_tests.rsbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/dynamic_type_builder.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/enum_decls.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_inferred_generic_type_args.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/stream_llm_inferred_typeargs.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/misc/dynamic_types.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/misc/dynamic_types_external_cycle_errors.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/misc/dynamic_types_internal_cycle_errors.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/misc/dynamic_types_parser_errors.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/syntax/misc/dynamic_types_validation_errors.bamlbaml_language/crates/baml_tests/baml_src/ns_class_type_args_at_runtime/class_type_args_at_runtime.bamlbaml_language/crates/baml_tests/baml_src/ns_inferred_generic_type_args/inferred_generic_type_args.bamlbaml_language/crates/baml_tests/baml_src/ns_instantiation_expr/instantiation_expr.bamlbaml_language/crates/baml_tests/baml_src/ns_instantiation_expr/ns_qualified/q.bamlbaml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces.bamlbaml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_2.bamlbaml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.bamlbaml_language/crates/baml_tests/baml_src/ns_interfaces_associated_types/interfaces_associated_types.bamlbaml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.bamlbaml_language/crates/baml_tests/baml_src/ns_prompt_tag_runtime/prompt_tag_runtime.bamlbaml_language/crates/baml_tests/baml_src/ns_provider_stdlib/provider_stdlib.bamlbaml_language/crates/baml_tests/baml_src/ns_reflect_type_of/reflect_type_of.bamlbaml_language/crates/baml_tests/baml_src/ns_reflect_type_of_generic/reflect_type_of_generic.bamlbaml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.bamlbaml_language/crates/baml_tests/baml_src/ns_streaming_parsing/streaming_parsing.bamlbaml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.bamlbaml_language/crates/baml_tests/projects/broken_syntax/removed_type_builder/removed_type_builder.bamlbaml_language/crates/baml_tests/projects/compiles/reflect_shadowing/main.bamlbaml_language/crates/baml_tests/projects/compiles/reflect_type_of_user_generic/main.bamlbaml_language/crates/baml_tests/projects/compiles/stream_llm_inferred_typeargs/main.bamlbaml_language/crates/baml_tests/projects/compiles/type_builder_errors/test.bamlbaml_language/crates/baml_tests/projects/compiles/type_builder_test/test.bamlbaml_language/crates/baml_tests/projects/compiles/type_kinds/main.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/format_checks/config_decls.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/removed_dynamic_attribute/removed_dynamic_attribute.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/removed_reflect_type_of/main.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/type_kinds/main.bamlbaml_language/crates/baml_tests/projects/diagnostic_errors/type_reflection_strict/reflect_intrinsic_errors.bamlbaml_language/crates/baml_tests/src/compiler2_mir/mod.rsbaml_language/crates/baml_tests/src/compiler2_tir/inference.rsbaml_language/crates/baml_tests/tests/env.rsbaml_language/crates/baml_tests/tests/interfaces.rsbaml_language/crates/baml_tests/tests/interfaces_associated_types.rsbaml_language/crates/baml_tests/tests/prompt_tag_runtime.rsbaml_language/crates/baml_tests/tests/reflect_call_any.rsbaml_language/crates/baml_tests/tests/streaming_parsing.rsbaml_language/crates/baml_tests/tests/type_kinds.rsbaml_language/crates/baml_tests/tests/type_value_equality.rsbaml_language/crates/baml_type/src/lib.rsbaml_language/crates/baml_type/src/normalize.rsbaml_language/crates/baml_type/src/template.rsbaml_language/crates/baml_type/src/type_kind.rsbaml_language/crates/bex_cache/src/lib.rsbaml_language/crates/bex_engine/src/conversion.rsbaml_language/crates/bex_engine/src/lib.rsbaml_language/crates/bex_engine/tests/generics_explicit.rsbaml_language/crates/bex_engine/tests/generics_inference.rsbaml_language/crates/bex_engine/tests/host_value_callable.rsbaml_language/crates/bex_heap/src/accessor.rsbaml_language/crates/bex_heap/src/gc.rsbaml_language/crates/bex_heap/src/heap.rsbaml_language/crates/bex_heap/src/tlab.rsbaml_language/crates/bex_vm/build.rsbaml_language/crates/bex_vm/src/lib.rsbaml_language/crates/bex_vm/src/package_baml/mod.rsbaml_language/crates/bex_vm/src/package_baml/ops.rsbaml_language/crates/bex_vm/src/package_baml/reflect.rsbaml_language/crates/bex_vm/src/package_baml/resolve.rsbaml_language/crates/bex_vm/src/package_baml/root.rsbaml_language/crates/bex_vm/src/package_baml/type_class.rsbaml_language/crates/bex_vm/src/package_baml/type_kinds.rsbaml_language/crates/bex_vm/src/package_boundary/mod.rsbaml_language/crates/bex_vm/src/vm.rsbaml_language/crates/bex_vm/tests/load_type.rsbaml_language/crates/bex_vm/tests/method_class_type_args.rsbaml_language/crates/bex_vm_types/src/link.rsbaml_language/crates/bex_vm_types/src/types.rsbaml_language/crates/bex_vm_types/src/types/class.rsbaml_language/crates/bex_vm_types/src/types/enums.rsbaml_language/crates/bex_vm_types/src/types/object.rsbaml_language/crates/bex_vm_types/src/types/type_value.rsbaml_language/crates/bridge_ctypes/src/value_encode.rsbaml_language/sdk_tests/crates/csharp/phase6_slice/baml_src/ns_csharp_phase6/main.bamlbaml_language/sdk_tests/fixtures/function_calls/baml_src/ns_generic_tests/types.bamlbaml_language/sdk_tests/fixtures/function_calls/baml_src/ns_go_type_tests/main.bamlbaml_language/sdks/python/rust/sdkgen_python_pydantic2/src/lib.rsbaml_language/sdks/python/rust/sdkgen_python_pydantic2/src/routing.rsbaml_language/sdks/rust/bridge_rust/tests/live_engine.rs
💤 Files with no reviewable changes (8)
- baml_language/crates/baml_compiler_lexer/src/tokens.rs
- baml_language/crates/baml_compiler_syntax/src/syntax_kind.rs
- baml_language/crates/baml_fmt/src/ast/tokens.rs
- baml_language/crates/baml_tests/projects/compiles/type_builder_errors/test.baml
- baml_language/crates/bex_vm/build.rs
- baml_language/crates/baml_tests/projects/compiles/type_builder_test/test.baml
- baml_language/crates/baml_tests/projects/diagnostic_errors/format_checks/config_decls.baml
- baml_language/crates/bex_vm/src/lib.rs
# Conflicts: # baml_language/crates/baml_compiler2_ast/src/lower_expr_body.rs # baml_language/crates/baml_compiler2_hir_ty/src/infer.rs # baml_language/crates/baml_tests/src/type_spec/snapshots/baml_tests__type_spec__sweep__s15_sweep_baml_src.snap # baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snap # baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snap
BEP-066 hir_ty port — full audit trailPer-slice log written by the port agent during the TIR→hir_ty port (referenced from the Handoff section of the PR description). BEP-066 hir_ty port log2026-08-14T15:05:57+02:00 — Phase A checkpoint
2026-08-14T15:20:00+02:00 — Slice 0 start
2026-08-14T15:28:03+02:00 — Slice 0 checkpoint
2026-08-14T15:36:00+02:00 — Slice 1 checkpoint
2026-08-14T15:46:03+02:00 — Slice 2 checkpoint
2026-08-14T16:35:00+02:00 — Slice 3 checkpoint
2026-08-14T16:43:22+02:00 — Slice 4 checkpoint
2026-08-14T17:19:38+02:00 — Slice 5 checkpoint
2026-08-14T18:10:22+02:00 — Slice 6 checkpoint
2026-08-14T20:00:43+02:00 — build-artifact maintenance checkpoint
2026-08-14T20:12:25+02:00 — Slice 7 checkpoint
2026-08-14T21:13:22+02:00 — Slice 8 checkpoint
2026-08-14T21:35:43+02:00 — Slice 9 checkpoint
2026-08-14T22:04:59+02:00 — pre-gate build-artifact maintenance checkpoint
2026-08-14T23:01:24+02:00 — Phase C pinned-gate audit
2026-08-14T23:46:47+02:00 — Phase C pinned gate green
2026-08-15T00:27:11+02:00 — latest-canary merge reconciliation
2026-08-15T01:14:17+02:00 — post-canary final pinned gate green
2026-08-15T01:58:55+02:00 — final canary drift and handoff checkpoint
|
Deep review of the hir_ty port commits (462dad2..3c22664)Automated adversarial review (referenced in the Handoff section of the PR description). Scope: MIR lowering, emit, runtime seams, contract invariants, and both canary-merge resolutions. Verdict: HOLD — findings 1-3 are silent semantic changes a green gate cannot catch; findings 4-8 are follow-up material. Full report: 1. HIGH — Union receivers now dispatch virtually off the first member only, preempting the guarded per-member dispatch
The defect is the interaction with the call road at Why tests miss it: the only union-dispatch fixture is homogeneous ( Verify: add a MIR fixture with 2. HIGH — Written union member order is lost in type arguments; the snapshot was edited to match
Observable in the tree: fixture This contradicts Verify: restore 3. HIGH —
|
|
Completed the ratified deep-review fixes and both CI follow-ups:
Verification: widened pinned gate passed 3,265 tests (23 skipped), all doctests/snapshot checks were clean; the full LSP suite passed 462 tests (1 ignored); focused pack/runtime/mounted suites passed. CI run 31887549367 is green, including Windows Cargo Tests job |
BEP-066: Evaluation, type construction, and reflection
Summary
This PR implements BEP-066 across the language, compiler, VM, package format, and host SDK boundary. BAML programs can inspect values and types, construct runtime types, compile and mount runtime packages, invoke reflected callables, and isolate dynamic work in sessions without weakening the static type system.
The resulting model has four properties:
requiresclauses, implementations, and callable targets without fabricated source locations.BEP-066 scenarios
ai/provider call and reflected back with the correct definition identity.baml_language/crates/baml_tests/tests/reflect_call_any.rsbaml_language/crates/baml_tests/tests/runtime_classes_and_composites.rsbaml_language/crates/baml_tests/tests/runtime_classes_and_composites.rsbaml_language/crates/baml_tests/tests/runtime_interface_witnesses.rsbaml_language/crates/baml_tests/tests/runtime_type_bindings.rs,runtime_package_api_consistency.rsbaml_language/crates/baml_tests/tests/runtime_package_compile.rsPackage.current, package enumeration, andget_functionwork for live and packed programs with loc-free callable targets.baml_language/crates/baml_tests/tests/runtime_package_compile.rs,baml_cli/tests/pack_e2e.rsbaml_language/crates/baml_tests/tests/runtime_session.rsConsistency and audit hardening
The implementation closes the consistency gaps found while auditing the end-to-end feature:
baml_language/crates/baml_tests/tests/constructor_consistency.rs.runtime_render_identity.rs.runtime_diagnostic_consistency.rs.get_enum,get_interface, kind-precise enumeration, null for wrong-kind or missing lookups, package-local identity, and distinct identity across packages. Seeruntime_package_api_consistency.rs.compiled_package_identity.rs.builder_witness_parity.rsandto_baml_witness_roundtrip.rs.Canary reconciliations
hir_tythe production inference engine, removed TIR, and establishedTYPE_SYSTEM.mdas the semantic authority. BEP-066 now lowers, checks, and reports diagnostics through that path only.ai, provider namespaces,@spec, and agents. Reflection and model-call coverage targets that current surface rather than the superseded stdlib layout.${...}interpolation, and obsolete Jinja metadata is not carried into runtime packages.hir_typort contractThe
hir_tyimplementation preserves the following invariants from syntax to execution:requires, implementation registrations, and method resolution are not reconstructed heuristically at runtime._remains an exact contextual hole. Let annotations and constructors solve permitted holes; declaration signatures and explicit call/upcast type arguments reject them with E0147. A top-levelthrows T | _is open and exposesTplus inferred throws to callers; plainthrows Tis closed.Intentional differences from the retired TIR behavior are part of the contract:
Selfwitness. Ambiguous multi-Selfshapes are rejected instead of being guessed.Selfsubstitution, andrequiresrealization follow the current spec andhir_tyrules where TIR behavior differed.The legacy root
engine/is not an authority for this work.Test evidence map
baml_typenormalization/type-kind unit tests; type-spec tables for reflection kinds and canonicalizationwildcard_hole_in_let_annotation.baml,wildcard_hole_in_constructor_generic_arg.baml,partial_throws_clause.baml,wildcard_type_inference.rs,wildcard_expression_holes.rshir_ty_package_interface,mounted_package_calls,mounted_package_parityreflect_call_any.rs,runtime_classes_and_composites.rs,runtime_interface_witnesses.rs,runtime_type_bindings.rs,runtime_package_compile.rs,runtime_session.rscompiled_package_identity.rs,constructor_consistency.rs,runtime_diagnostic_consistency.rs,runtime_package_api_consistency.rs,runtime_render_identity.rsbuilder_witness_parity.rs,to_baml_witness_roundtrip.rsbaml_cli/tests/pack_e2e.rsVerification state
rustup run 1.93.0 cargo insta test --test-runner nextest -p baml_tests -p baml_cli -p baml_lsp2_actions -p baml_lsp2_actions_tests -p baml_surface --all-features --unreferenced=reject): 3,265 passed, 0 failed (23 skipped), all doctests passed or were intentionally ignored, no unreferenced snapshots, and no pending.snap.new.baml.crypto#4431 crypto, feat(runtime): make connection pooling configurable #3975 connection pooling, Handle double-quote string prompts #4432 quote prompts, String method standardization #4433 string standardization) verified by focused validation (targeted runtime/stdlib/compiler suites + no-update snapshot replays); the authoritative final signal is this PR's CI on the head commit.Handoff notes (for the next agent or human working on this)
State: everything above is on the head commit. No temporary port constructs remain in the tree — the Phase-A stub (
E_BEP066_PORT_IN_PROGRESS), fixture exclusions, and port-era test ignores are all gone (verified by grep).Authoritative documents:
CONTRACTS.md(repo root, this branch) — the binding data-model contracts (runtime type slots /CallPlan, loc-freeSymbolicCallableTarget, scoped generic overlay) plus the 35-fact acceptance checklist with per-fact conditions.antoniosarosi/hir-ty-research(TIR_HIRTY_MIGRATION_GUIDE.md) — the architecture map, worked examples, and risk register the port followed.antoniosarosi/wildcard-adjudication(WILDCARD_VERDICTS.md) — per-test rulings for the formerly ignored B-230/B-247 cases.Deep review findings (resolved): the adversarial review of the six port commits (
462dad20b..3c2266446) is complete — full report in this comment. All four ratified blockers landed inf239a032fand passed the widened pinned gate:audio | imageand the other written forms.Canary integration and audited follow-ups are recorded in
55f6318f5,957d4514b,4fef90eff, and8de2d10bb. Report findings 4, 6, and 8 remain agreed fast-follow work; finding 9 remains explicitly pre-existing. The report's clean-area conclusions remain valid.CI playbook for this branch:
.conclusion, thengh run rerun <run-id> --failed(up to 2 attempts).Package.compiletest) is already fixed with an explicit 30s timeout.baml_language/crates/tools_size_gate/src/config.rsto baseline×1.03 as a single-file commit.rustup run 1.93.0 cargo insta test --test-runner nextest -p baml_tests -p baml_cli -p baml_lsp2_actions -p baml_lsp2_actions_tests -p baml_surface --all-features --unreferenced=rejectAgreed follow-up PRs (deliberately not in this PR):
sdk_test_typescript_web(max-threads = 1) — prevents concurrent ~8 GiB transient workerd import peaks from stacking (measured; this OOM'd a dev machine).bridge_web_core_bg.wasm(wasm-opt is currently disabled in its package metadata); consider splitting compiler-only code out of the runtime web bridge.emit_unitsvariant that accepts it, soPackage.compile's first call skips the ~4–5 s full 90-file stdlib recompile (measured; a lazy in-process cache is not sufficient for the first-call cost).Coordination items:
SymbolicCallableTargetincallable.rs; thePackageInterfaceBorsh expansion) should get a review from the hir_ty owner — they were frozen unilaterally under time pressure and intentionally invalidate cached package-interface bytes per compiler build.visit_headshook is reserved for this).Semantic authority:
TYPE_SYSTEM.md+ current hir_ty behavior. Do not "fix" anything back toward TIR-era snapshots or ignored TIR-era test expectations — several behavior deltas (conjunctive bounds, one-Selfexistential dispatch, hole/E0147 handling) are intentional and contract-pinned.Reviewer entry points
baml_language/TYPE_SYSTEM.md, the BEP-066 specification, andbaml_language/crates/baml_builtins2/baml_std/baml/ns_reflect/.baml_language/crates/baml_type/src/type_kind.rsandnormalize.rs.baml_compiler2_hirandbaml_compiler2_hir_ty.baml_language/crates/baml_compiler2_hir_ty/src/infer.rs,callable.rs,package_interface.rs,impls.rs, and interface method resolution.baml_compiler2_mirand its bytecode emitter.baml_language/crates/bex_vm.