Skip to content

Handle typeargs in pattern matching - #4203

Merged
2kai2kai2 merged 9 commits into
canaryfrom
kai/split-template-ty
Jul 27, 2026
Merged

2kai2kai2 merged 9 commits into
canaryfrom
kai/split-template-ty

Conversation

@2kai2kai2

@2kai2kai2 2kai2kai2 commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor
  • TyTemplate no longer has wildcard variants: they had no valid usages and this PR removed the unsound usages they previously had. TyTemplate is thus left as similar to RuntimeTy except using De Bruijn frame indices rather than name-based lookup.
  • Checking the overlap of type patterns and the scrutinee is now done via unification (using a shared core with the interface impl coherence checker), enabling a much more accurate and granular determination.
  • Type vars are now treated as rigid, bounded, but opaque types instead of wildcards for exhaustiveness/reachability determinations.
  • Interface default method bodies now have a frame slot for Self: while other contexts can lower Self in terms of the generic parameters in their call frame, non-monomorphized default method bodies cannot. This should enable Self to be realized in all contexts where it is permitted syntax.
  • Normalization of scrutinees now uses the canonical type algebra implementation from baml_type
  • Patterns with associated types now correctly realize from frame at runtime.
  • Type expr/ref lowering now validates arity and associated type pins (interface existentials must pin all non-defaulted associated types; interface bounds do not have to and do not get default pins, similar to Rust). This ensures a single centralized path instead of the inconsistent and scattered implementations we previously had, with Ty::Error filled to suppress with downstream diagnostics. Note that this does not validate that passed type args satisfy bounds, as doing so requires cycle handling (so is done post-lowering)

Summary by CodeRabbit

  • New Features

    • Added clearer compile-time errors for unsupported function-typed patterns and invalid interface projection shorthand.
    • Improved associated-type projection diagnostics and generic runtime type tests for is/match, including better Self/default Self seeding and per-instantiation interface reflection.
  • Bug Fixes

    • Fixed array iteration to yield stored null elements and closure elements.
    • Corrected match dispatch/stack behavior across switch strategies and call-scrutinee scenarios.
    • Tightened generic, rigid type variable, and container element invariance coverage.
  • Tests

    • Expanded end-to-end and diagnostic suites to lock in the updated semantics and error messages.

@vercel

vercel Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jul 27, 2026 2:12am
promptfiddle Ready Ready Preview, Comment Jul 27, 2026 2:12am
promptfiddle2 Ready Ready Preview, Comment Jul 27, 2026 2:12am

Request Review

@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change revises compiler2 type lowering, rigid-pattern overlap, interface frames, runtime type checks, template substitution, PPIR associated-type preservation, diagnostics, and regression coverage. It also fixes nullable array iteration and switch stack simulation.

Changes

Compiler2 matching and type-frame pipeline

Layer / File(s) Summary
Type lowering and overlap foundations
baml_language/crates/baml_compiler2_tir/src/{builder.rs,lower_type_expr.rs,pattern_overlap.rs,unify.rs,exhaustiveness.rs}
Constraint-head lowering, alias normalization, rigid-type overlap, invariant generic matching, and exhaustiveness handling are revised.
Interface bindings and Self frames
baml_language/crates/baml_compiler2_tir/src/{interfaces.rs,interfaces/*,inference.rs}, baml_language/crates/baml_compiler2_emit/src/{lib.rs,emit.rs}, baml_language/crates/baml_compiler2_mir/src/lower.rs
Interface defaults, associated bindings, Self slots, default-method frames, and interface dispatch candidate checks are updated.
Runtime type tags and stack simulation
baml_language/crates/baml_compiler2_mir/src/{ir.rs,optimize.rs,pretty.rs}, baml_language/crates/baml_compiler2_emit/src/{analysis.rs,emit.rs,pull_semantics.rs,stack_carry.rs}
Rvalue::IsTypeTag is analyzed, printed, pulled, emitted, and simulated; switch stack simulation follows strategy-specific discriminant pulls.
Template and VM matching
baml_language/crates/baml_type/src/{family.rs,template.rs}, baml_language/crates/bex_vm/src/{type_match.rs,vm.rs,package_baml/*}, baml_language/crates/bex_engine/src/conversion.rs
Wildcard template variants are removed, frame-reference substitution becomes explicit, and VM type matching propagates substitution errors and uses invariant class-argument checks.
PPIR, diagnostics, and regression coverage
baml_language/crates/baml_compiler2_ppir/src/*, baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs, baml_language/crates/baml_lsp2_actions/src/check.rs, baml_language/crates/baml_tests/**/*
Named PPIR types retain associated bindings; new diagnostics cover invalid projections and function-typed runtime tests; compiler and runtime tests cover frames, patterns, iterators, switches, reflection, and matching.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related PRs

Suggested reviewers: hellovai, aaronvg, antoniosarosi

Poem

A rabbit hops through types anew,
With Self in frames and tags in view.
Nulls now hop from arrays bright,
Patterns test with bounded sight.
Wildcards rest; frames rule the day.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and directly describes the main change: improved type-argument handling in pattern matching.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kai/split-template-ty

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 25, 2026 23:01 Inactive
@github-actions

github-actions Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 27.3 MB 11.6 MB file 27.1 MB +190.2 KB (+0.7%) OK
✅ packed-program Linux 🔒 17.7 MB 7.3 MB file 17.6 MB +38.7 KB (+0.2%) OK
✅ baml-cli macOS 🔒 21.2 MB 10.1 MB file 21.0 MB +182.2 KB (+0.9%) OK
✅ packed-program macOS 🔒 13.8 MB 6.4 MB file 13.8 MB +49.7 KB (+0.4%) OK
✅ baml-cli Windows 🔒 22.8 MB 10.3 MB file 22.7 MB +162.3 KB (+0.7%) OK
✅ packed-program Windows 🔒 14.7 MB 6.5 MB file 14.7 MB +35.1 KB (+0.2%) OK
✅ bridge_wasm WASM 16.5 MB 🔒 4.5 MB gzip 4.5 MB +29.8 KB (+0.7%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

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_compiler2_tir/src/lower_type_expr.rs (1)

831-855: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

suggestions are collected from an FxHashSet, so their order is nondeterministic.

known_associated_types is a hash set, so the "did you mean" list in UnresolvedType varies run to run — user-visible churn and a snapshot-test flake source. Take them from iface_data.associated_types in declaration order instead.

🔧 Proposed fix
                                 if !known_associated_types.contains(&binding.name) {
                                     diagnostics.push(TirTypeError::UnresolvedType {
                                         name: binding.name.clone(),
-                                        suggestions: known_associated_types
-                                            .iter()
-                                            .cloned()
-                                            .collect(),
+                                        suggestions: iface_data
+                                            .associated_types
+                                            .iter()
+                                            .map(|assoc| assoc.name.clone())
+                                            .collect(),
                                     });
                                     return None;
                                 }
🤖 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` around lines
831 - 855, Build UnresolvedType.suggestions from iface_data.associated_types in
declaration order instead of iterating known_associated_types, while retaining
known_associated_types for membership checks. Update the filtering logic around
lowered_associated_bindings so suggestions are deterministic and match the
interface declaration order.
🧹 Nitpick comments (4)
baml_language/crates/baml_compiler2_tir/src/builder.rs (1)

16394-16402: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add #[cfg(test)] unit tests for the new pure helpers.

ty_contains_unresolved, widen_literal_members, and ty_claims_function_values are self-contained (no &self DB access for the first two), so their edge cases — BuiltinUnknown deliberately not counting as unresolved, literal widening through one union level, function types nested under a class — are cheap to pin down in-crate rather than only through the .baml regression projects.

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_tir/src/builder.rs` around lines 16394 -
16402, Under a new #[cfg(test)] module in the same crate, add unit tests
covering the pure helpers ty_contains_unresolved, widen_literal_members, and
ty_claims_function_values. Verify BuiltinUnknown is not considered unresolved,
literal types widen through one union level, and function values nested under a
class are detected, using the existing type constructors and assertions without
changing helper behavior.

Source: Coding guidelines

baml_language/crates/baml_compiler2_mir/src/lower.rs (1)

11089-11107: 📐 Maintainability & Code Quality | 🔵 Trivial

BUG note is well-scoped, but it should be trackable.

The BUG(symbolic-view-field-read) note documents a real soundness hole (symbolic interface view picking the wrong linked field) with no guard in code. Want me to open an issue capturing the two proposed fixes (open-world virtual field access, or rejecting symbolic-view field reads of multi-block classes)?

🤖 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_mir/src/lower.rs` around lines 11089 -
11107, Make the documented symbolic-view field-read soundness issue trackable by
creating an issue that records the two proposed remedies: implement open-world
virtual field access using the requested view, or reject symbolic-view field
reads for classes with multiple same-family in-body blocks. Reference the
existing BUG(symbolic-view-field-read) marker and preserve its explanation in
the issue.
baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs (1)

589-596: 📐 Maintainability & Code Quality | 🔵 Trivial

Track the acknowledged E0153 collision.

E0153 is returned for both GenericSysOpMethodInInterfaceImpl (Line 576) and BuiltinInterfaceNotImplementable (Line 593), so the two errors are indistinguishable by code in LSP output and docs. The new E0155/E0156 assignments are free and correct; only the marked collision remains.

Want me to open an issue to renumber one of them (with the user-facing code-change note)?

🤖 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_diagnostics/src/diagnostic.rs` around
lines 589 - 596, Preserve the existing diagnostic-code assignments and track the
acknowledged E0153 collision between GenericSysOpMethodInInterfaceImpl and
BuiltinInterfaceNotImplementable as a follow-up issue, including that resolving
it requires a user-facing code change. Do not renumber either diagnostic or
alter the valid E0155 and E0156 mappings in this change.
baml_language/crates/baml_compiler2_emit/src/stack_carry.rs (1)

499-536: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Multi-pull discriminant simulation looks correct; consider a direct unit test.

Traced through the reject-on-reuse path (a stack-carried local reached via discriminant in an if-else chain) and the zero-pull edge cases — behavior matches the doc comment's intent and I didn't find a correctness gap. The new switch_discriminant_pull_counts_per_strategy test (in emit.rs) only pins the pull counts though, not simulate_terminator_stack's actual accept/reject behavior for this arm. Given how subtle this logic is (the exact scenario this PR is fixing a latent miscompile for), a small dedicated unit test constructing a stack-carried candidate whose discriminant reaches it through an if-else-chain-eligible switch would pin the behavior directly rather than relying on manual reasoning.

🤖 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/stack_carry.rs` around lines 499
- 536, Add a focused unit test for simulate_terminator_stack covering a
stack-carried candidate whose switch discriminant reaches the carried local
through a Virtual/discriminant chain and uses an if-else-chain-eligible switch.
Assert the candidate is rejected after the simulated discriminant is pulled more
than once, while preserving existing acceptance behavior for valid single-pull
strategies. Place the test alongside
switch_discriminant_pull_counts_per_strategy in emit.rs.
🤖 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_compiler2_emit/src/lib.rs`:
- Around line 484-494: Update the interface-associated-type binding logic around
param_names and iface_arg_tys to handle arity mismatches explicitly: bind every
declared parameter, using the appropriate poison type when no corresponding
argument exists, and add a guard/assertion for the expected shape before
substitution. Ensure completed contains no unbound declared type variables
before tir2_to_template is called, preventing emitter panics while preserving
normal bindings.

In `@baml_language/crates/baml_compiler2_mir/src/lower.rs`:
- Around line 8106-8148: Update the associated-type default resolution in the
`assoc_tys` construction to process declarations in order and seed each resolved
associated type into `default_bindings` under its name. Use those accumulated
bindings when substituting later defaults, while preserving explicit
`assoc_bindings` precedence and the existing `BuiltinUnknown` fallback for
unresolved types.

In `@baml_language/crates/baml_compiler2_tir/src/builder.rs`:
- Around line 8824-8832: Update ty_contains_unresolved to use a separate
Ty::Interface arm that checks both its args and associated_bindings, recursively
traversing each (name, ty) binding value alongside the existing type arguments.
Keep the Class and Union handling unchanged.

In `@baml_language/crates/bex_vm_types/src/types/const_value.rs`:
- Around line 49-85: Update both constant-pool conversion paths that currently
call ConstValue::to_value to explicitly skip ConstValue::Type and
ConstValue::ClassWithTypeArgs before conversion. Preserve these raw constants
for LoadType and IsType execution, while continuing to convert all other
supported non-Float constants through to_value.

In `@baml_language/crates/bex_vm/src/vm.rs`:
- Around line 1804-1813: Narrow the inline rationale around ClassWithTypeArgs
invariant matching to state that widened unions are accepted only when the
stored argument is a subsumed member and the canonical algebra collapses the
union. Ensure the explanation does not imply that disjoint unions such as int |
string match a stored int, consistent with
class_arg_frame_ref_resolves_and_relates_invariantly.

---

Outside diff comments:
In `@baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs`:
- Around line 831-855: Build UnresolvedType.suggestions from
iface_data.associated_types in declaration order instead of iterating
known_associated_types, while retaining known_associated_types for membership
checks. Update the filtering logic around lowered_associated_bindings so
suggestions are deterministic and match the interface declaration order.

---

Nitpick comments:
In `@baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs`:
- Around line 589-596: Preserve the existing diagnostic-code assignments and
track the acknowledged E0153 collision between GenericSysOpMethodInInterfaceImpl
and BuiltinInterfaceNotImplementable as a follow-up issue, including that
resolving it requires a user-facing code change. Do not renumber either
diagnostic or alter the valid E0155 and E0156 mappings in this change.

In `@baml_language/crates/baml_compiler2_emit/src/stack_carry.rs`:
- Around line 499-536: Add a focused unit test for simulate_terminator_stack
covering a stack-carried candidate whose switch discriminant reaches the carried
local through a Virtual/discriminant chain and uses an if-else-chain-eligible
switch. Assert the candidate is rejected after the simulated discriminant is
pulled more than once, while preserving existing acceptance behavior for valid
single-pull strategies. Place the test alongside
switch_discriminant_pull_counts_per_strategy in emit.rs.

In `@baml_language/crates/baml_compiler2_mir/src/lower.rs`:
- Around line 11089-11107: Make the documented symbolic-view field-read
soundness issue trackable by creating an issue that records the two proposed
remedies: implement open-world virtual field access using the requested view, or
reject symbolic-view field reads for classes with multiple same-family in-body
blocks. Reference the existing BUG(symbolic-view-field-read) marker and preserve
its explanation in the issue.

In `@baml_language/crates/baml_compiler2_tir/src/builder.rs`:
- Around line 16394-16402: Under a new #[cfg(test)] module in the same crate,
add unit tests covering the pure helpers ty_contains_unresolved,
widen_literal_members, and ty_claims_function_values. Verify BuiltinUnknown is
not considered unresolved, literal types widen through one union level, and
function values nested under a class are detected, using the existing type
constructors and assertions without changing helper behavior.
🪄 Autofix (Beta)

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: 62834cc6-b53f-4a94-afd0-ee17dc441c54

📥 Commits

Reviewing files that changed from the base of the PR and between 6dde8b2 and 8e88345.

⛔ Files ignored due to path filters (78)
  • baml_language/crates/baml_tests/snapshots/baml_src/_root.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/comparable_sort.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/exceptions.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_rigid.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_typevar.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/inferred_generic_type_args.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces_associated_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_closure_elements.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_impl_generics_only.core.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_alias.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_parse_stringify.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_to_from_string.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_call_scrutinee.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_container_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_self_workaround.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/patterns_new_runtime.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/projection_patterns.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/self_frame_slot.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__array_rest_binding_no_suffix_slices_to_len.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__array_rest_binding_with_suffix_slices_middle.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__match_or_mixed_array_class_binding_uses_branch_local_rest_type.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__10_formatter__patterns_new.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__01_lexer__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__02_parser__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__10_formatter__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__10_formatter__negative.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__01_lexer__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__02_parser__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__10_formatter__match_exhaustiveness.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_textual.snap is excluded by !**/*.snap
📒 Files selected for processing (63)
  • baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml
  • baml_language/crates/baml_compiler2_emit/src/analysis.rs
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_compiler2_emit/src/pull_semantics.rs
  • baml_language/crates/baml_compiler2_emit/src/stack_carry.rs
  • baml_language/crates/baml_compiler2_mir/src/ir.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_mir/src/optimize.rs
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_compiler2_ppir/src/expand.rs
  • baml_language/crates/baml_compiler2_ppir/src/ty.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/associated_projection.rs
  • baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/coherence.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs
  • baml_language/crates/baml_compiler2_tir/src/lib.rs
  • baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs
  • baml_language/crates/baml_compiler2_tir/src/pattern_overlap.rs
  • baml_language/crates/baml_compiler2_tir/src/unify.rs
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_lsp2_actions/src/check.rs
  • baml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_rigid/generic_match_rigid.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_typevar/generic_match_typevar.baml
  • baml_language/crates/baml_tests/baml_src/ns_inferred_generic_type_args/inferred_generic_type_args.baml
  • baml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.baml
  • baml_language/crates/baml_tests/baml_src/ns_iter_closure_elements/iter_closure_elements.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_call_scrutinee/match_call_scrutinee.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_container_types/match_container_types.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_self_workaround/match_self_workaround.baml
  • baml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.baml
  • baml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.baml
  • baml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.baml
  • baml_language/crates/baml_tests/projects/compiles/patterns_new/patterns_new.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/alias_bounds/alias_bounds.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/fn_typed_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/function_type_missing_throws/negative.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_bound_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_rigid_coverage/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/match_exhaustiveness/match_exhaustiveness.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.baml
  • baml_language/crates/baml_tests/tests/comparable_sort.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_tests/tests/interfaces_associated_types.rs
  • baml_language/crates/baml_tests/tests/match_union_typevar.rs
  • baml_language/crates/baml_type/src/family.rs
  • baml_language/crates/baml_type/src/template.rs
  • baml_language/crates/baml_type_macros/src/emit.rs
  • baml_language/crates/baml_type_macros/src/parse.rs
  • baml_language/crates/baml_type_runtime/src/lib.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/crates/bex_vm/src/package_baml/json.rs
  • baml_language/crates/bex_vm/src/package_baml/resolve.rs
  • baml_language/crates/bex_vm/src/type_match.rs
  • baml_language/crates/bex_vm/src/vm.rs
  • baml_language/crates/bex_vm_types/src/errors.rs
  • baml_language/crates/bex_vm_types/src/types.rs
  • baml_language/crates/bex_vm_types/src/types/const_value.rs

Comment thread baml_language/crates/bex_vm/src/vm.rs Resolved
@2kai2kai2
2kai2kai2 force-pushed the kai/split-template-ty branch from 8e88345 to c376062 Compare July 27, 2026 01:19
They were only produced because we don't correctly handle type args in
some places. Instead of introducing wildcards and producing incorrect
results via them, we now just fail-closed (still wrong but without the
complexity)
Also interface field accesses now use the type tag instead of an
unnecessary class partial match system, as field links can only be
created in in-body `implements` blocks.
This will allow us to properly handle type args for reachability of type
patterns.

Also moves the unification logic core shared with coherence to its own
module
@2kai2kai2
2kai2kai2 force-pushed the kai/split-template-ty branch from c376062 to 2a31975 Compare July 27, 2026 01:20
@vercel
vercel Bot temporarily deployed to Preview – beps July 27, 2026 01:21 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 27, 2026 01:30 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml (1)

249-252: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add a semantic_tokens expectation back to this fixture.

This file is under test_files/semantic_tokens/, but the inline runner only asserts semantic tokens when it parses an actual //- semantic_tokens section. Add the expected block so this case still validates token output instead of only diagnostics.

🤖 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_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml`
around lines 249 - 252, Add a //- semantic_tokens expectation block to the
patterns_new.baml fixture, alongside the existing no-diagnostics expectation,
and populate it with the expected tokens for this case so the semantic-token
runner validates output.
🧹 Nitpick comments (1)
baml_language/crates/bex_vm/src/vm.rs (1)

1004-1017: 📐 Maintainability & Code Quality | 🔵 Trivial

Track the BUG(erased-signature-reconstruction) gap.

Both comments describe the same unimplemented fix (store signatures as templates over frame slots). Want me to open an issue so the BoundMethod/E0155 follow-up isn't only recorded in code comments?

Also applies to: 2051-2059

🤖 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 1004 - 1017, Create a
tracking issue for the erased-signature-reconstruction gap described near the VM
callable reconstruction logic, covering signature templates over frame
type-argument slots, BoundMethod reconstruction, and relaxing E0155 for
function-typed patterns. Link or reference the issue from both BUG comments so
the follow-up is centrally tracked rather than recorded only in source comments.
🤖 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.

Outside diff comments:
In
`@baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml`:
- Around line 249-252: Add a //- semantic_tokens expectation block to the
patterns_new.baml fixture, alongside the existing no-diagnostics expectation,
and populate it with the expected tokens for this case so the semantic-token
runner validates output.

---

Nitpick comments:
In `@baml_language/crates/bex_vm/src/vm.rs`:
- Around line 1004-1017: Create a tracking issue for the
erased-signature-reconstruction gap described near the VM callable
reconstruction logic, covering signature templates over frame type-argument
slots, BoundMethod reconstruction, and relaxing E0155 for function-typed
patterns. Link or reference the issue from both BUG comments so the follow-up is
centrally tracked rather than recorded only in source comments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cd6719e3-083e-4ea3-b313-750d08866a86

📥 Commits

Reviewing files that changed from the base of the PR and between 8e88345 and 2a31975.

⛔ Files ignored due to path filters (79)
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_package_listing.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/_root.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/comparable_sort.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/exceptions.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_rigid.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_typevar.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/inferred_generic_type_args.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces_associated_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_closure_elements.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_impl_generics_only.core.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_alias.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_parse_stringify.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_to_from_string.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_call_scrutinee.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_container_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_self_workaround.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/patterns_new_runtime.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/projection_patterns.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/self_frame_slot.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__array_rest_binding_no_suffix_slices_to_len.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__array_rest_binding_with_suffix_slices_middle.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiler2_mir/baml_tests__compiler2_mir__match_or_mixed_array_class_binding_uses_branch_local_rest_type.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__10_formatter__patterns_new.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__01_lexer__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__02_parser__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__10_formatter__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__10_formatter__negative.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__01_lexer__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__02_parser__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__10_formatter__match_exhaustiveness.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_textual.snap is excluded by !**/*.snap
📒 Files selected for processing (64)
  • baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml
  • baml_language/crates/baml_compiler2_emit/src/analysis.rs
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_compiler2_emit/src/pull_semantics.rs
  • baml_language/crates/baml_compiler2_emit/src/stack_carry.rs
  • baml_language/crates/baml_compiler2_mir/src/ir.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_mir/src/optimize.rs
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_compiler2_ppir/src/expand.rs
  • baml_language/crates/baml_compiler2_ppir/src/ty.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/associated_projection.rs
  • baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/coherence.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs
  • baml_language/crates/baml_compiler2_tir/src/lib.rs
  • baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs
  • baml_language/crates/baml_compiler2_tir/src/pattern_overlap.rs
  • baml_language/crates/baml_compiler2_tir/src/unify.rs
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_lsp2_actions/src/check.rs
  • baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml
  • baml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_rigid/generic_match_rigid.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_typevar/generic_match_typevar.baml
  • baml_language/crates/baml_tests/baml_src/ns_inferred_generic_type_args/inferred_generic_type_args.baml
  • baml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.baml
  • baml_language/crates/baml_tests/baml_src/ns_iter_closure_elements/iter_closure_elements.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_call_scrutinee/match_call_scrutinee.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_container_types/match_container_types.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_self_workaround/match_self_workaround.baml
  • baml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.baml
  • baml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.baml
  • baml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.baml
  • baml_language/crates/baml_tests/projects/compiles/patterns_new/patterns_new.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/alias_bounds/alias_bounds.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/fn_typed_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/function_type_missing_throws/negative.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_bound_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_rigid_coverage/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/match_exhaustiveness/match_exhaustiveness.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.baml
  • baml_language/crates/baml_tests/tests/comparable_sort.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_tests/tests/interfaces_associated_types.rs
  • baml_language/crates/baml_tests/tests/match_union_typevar.rs
  • baml_language/crates/baml_type/src/family.rs
  • baml_language/crates/baml_type/src/template.rs
  • baml_language/crates/baml_type_macros/src/emit.rs
  • baml_language/crates/baml_type_macros/src/parse.rs
  • baml_language/crates/baml_type_runtime/src/lib.rs
  • baml_language/crates/bex_engine/src/conversion.rs
  • baml_language/crates/bex_vm/src/package_baml/json.rs
  • baml_language/crates/bex_vm/src/package_baml/resolve.rs
  • baml_language/crates/bex_vm/src/type_match.rs
  • baml_language/crates/bex_vm/src/vm.rs
  • baml_language/crates/bex_vm_types/src/errors.rs
  • baml_language/crates/bex_vm_types/src/types.rs
  • baml_language/crates/bex_vm_types/src/types/const_value.rs
🚧 Files skipped from review as they are similar to previous changes (53)
  • baml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.baml
  • baml_language/crates/baml_type_macros/src/parse.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_rigid_coverage/main.baml
  • baml_language/crates/baml_compiler2_tir/src/lib.rs
  • baml_language/crates/baml_type_macros/src/emit.rs
  • baml_language/crates/baml_compiler2_mir/src/ir.rs
  • baml_language/crates/baml_compiler2_emit/src/pull_semantics.rs
  • baml_language/crates/baml_tests/baml_src/ns_inferred_generic_type_args/inferred_generic_type_args.baml
  • baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml
  • baml_language/crates/baml_tests/tests/match_union_typevar.rs
  • baml_language/crates/bex_vm_types/src/errors.rs
  • baml_language/crates/baml_tests/tests/interfaces_associated_types.rs
  • baml_language/crates/baml_lsp2_actions/src/check.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/alias_bounds/alias_bounds.baml
  • baml_language/crates/baml_tests/projects/compiles/patterns_new/patterns_new.baml
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/match_exhaustiveness/match_exhaustiveness.baml
  • baml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.baml
  • baml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.baml
  • baml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/fn_typed_patterns/main.baml
  • baml_language/crates/baml_compiler2_emit/src/stack_carry.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_compiler2_ppir/src/ty.rs
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_bound_patterns/main.baml
  • baml_language/crates/baml_compiler2_emit/src/analysis.rs
  • baml_language/crates/baml_compiler2_tir/src/pattern_overlap.rs
  • baml_language/crates/baml_tests/baml_src/ns_match_call_scrutinee/match_call_scrutinee.baml
  • baml_language/crates/baml_compiler2_mir/src/optimize.rs
  • baml_language/crates/bex_vm_types/src/types/const_value.rs
  • baml_language/crates/baml_compiler2_ppir/src/expand.rs
  • baml_language/crates/bex_vm_types/src/types.rs
  • baml_language/crates/baml_type_runtime/src/lib.rs
  • baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
  • baml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.baml
  • baml_language/crates/baml_tests/tests/comparable_sort.rs
  • baml_language/crates/baml_type/src/family.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/associated_projection.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces.rs
  • baml_language/crates/bex_vm/src/package_baml/json.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.baml
  • baml_language/crates/bex_vm/src/type_match.rs
  • baml_language/crates/bex_vm/src/package_baml/resolve.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/coherence.rs
  • baml_language/crates/baml_compiler2_tir/src/unify.rs
  • baml_language/crates/baml_type/src/template.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 27, 2026 01:42 Inactive
Still doesn't update emitted code though-- fails closed
`Self` is now passed in the frame for default interface method bodies.
Also removes `Self`'s associated types from the default interface method
frames. We instead use symbolic resolution like everywhere else.
@2kai2kai2
2kai2kai2 force-pushed the kai/split-template-ty branch from 2a31975 to 62b3c55 Compare July 27, 2026 01:51
@vercel
vercel Bot temporarily deployed to Preview – beps July 27, 2026 01:53 Inactive
@2kai2kai2
2kai2kai2 enabled auto-merge July 27, 2026 01:53
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 27, 2026 02:00 Inactive

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs (1)

866-937: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for the backward Self default ordering edge.

The existing Batch<Item = int, Items = Self.Item[]> case covers an earlier referenced Item, but not type A = Self.B where B comes later, is unpinned, and has type B = .... Add that case to baml_language/crates/baml_tests/tests/interfaces_associated_types.rs as a Rust unit test so the intended ordering behavior is covered.

🤖 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` around lines
866 - 937, Add a Rust unit test in interfaces_associated_types.rs covering an
existential with a default `A = Self.B`, where later unpinned associated type
`B` has its own default. Assert the backward reference resolves correctly, while
preserving the existing forward-reference Batch coverage.
🤖 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.

Nitpick comments:
In `@baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs`:
- Around line 866-937: Add a Rust unit test in interfaces_associated_types.rs
covering an existential with a default `A = Self.B`, where later unpinned
associated type `B` has its own default. Assert the backward reference resolves
correctly, while preserving the existing forward-reference Batch coverage.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: bc50be3f-f53c-4c25-be3f-f748de9739dd

📥 Commits

Reviewing files that changed from the base of the PR and between 2a31975 and 62b3c55.

⛔ Files ignored due to path filters (72)
  • baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_package_listing.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/_root.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/comparable_sort.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/exceptions.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_rigid.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/generic_match_typevar.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/inferred_generic_type_args.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/interfaces_associated_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_closure_elements.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/iter_impl_generics_only.core.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_alias.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_parse_stringify.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/json_to_from_string.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_call_scrutinee.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_container_types.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/match_self_workaround.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/patterns_new_runtime.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/projection_patterns.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/baml_src/self_frame_slot.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__assert_std__/baml_tests__compiles____assert_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__baml_std__/baml_tests__compiles____baml_std____06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/json_parse_stringify_intrinsics/baml_tests__compiles__json_parse_stringify_intrinsics__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_5_mir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__06_codegen.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/patterns_new/baml_tests__compiles__patterns_new__10_formatter__patterns_new.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/compiles/type_annotation/baml_tests__compiles__type_annotation__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/alias_bounds/baml_tests__diagnostic_errors__alias_bounds__10_formatter__alias_bounds.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/fn_typed_patterns/baml_tests__diagnostic_errors__fn_typed_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/function_type_missing_throws/baml_tests__diagnostic_errors__function_type_missing_throws__10_formatter__negative.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_bound_patterns/baml_tests__diagnostic_errors__generic_bound_patterns__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generic_rigid_coverage/baml_tests__diagnostic_errors__generic_rigid_coverage__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/generics/baml_tests__diagnostic_errors__generics__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__03_ppir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/match_exhaustiveness/baml_tests__diagnostic_errors__match_exhaustiveness__10_formatter__match_exhaustiveness.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure/baml_tests__diagnostic_errors__patterns_class_destructure__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/patterns_class_destructure_namespaces/baml_tests__diagnostic_errors__patterns_class_destructure_namespaces__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__04_tir.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__05_diagnostics.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/snapshots/diagnostic_errors/self_in_body/baml_tests__diagnostic_errors__self_in_body__10_formatter__main.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_expanded_unoptimized.snap is excluded by !**/*.snap
  • baml_language/crates/baml_tests/tests/bytecode_format/snapshots/bytecode_format__bytecode_display_textual.snap is excluded by !**/*.snap
📒 Files selected for processing (51)
  • baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_compiler2_emit/src/stack_carry.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_compiler2_ppir/src/expand.rs
  • baml_language/crates/baml_compiler2_ppir/src/ty.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/associated_projection.rs
  • baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs
  • baml_language/crates/baml_compiler2_tir/src/lower_type_expr.rs
  • baml_language/crates/baml_compiler2_tir/src/pattern_overlap.rs
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_lsp2_actions/src/check.rs
  • baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml
  • baml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_rigid/generic_match_rigid.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_typevar/generic_match_typevar.baml
  • baml_language/crates/baml_tests/baml_src/ns_inferred_generic_type_args/inferred_generic_type_args.baml
  • baml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.baml
  • baml_language/crates/baml_tests/baml_src/ns_iter_closure_elements/iter_closure_elements.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_call_scrutinee/match_call_scrutinee.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_container_types/match_container_types.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_self_workaround/match_self_workaround.baml
  • baml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.baml
  • baml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.baml
  • baml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.baml
  • baml_language/crates/baml_tests/projects/compiles/patterns_new/patterns_new.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/alias_bounds/alias_bounds.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/fn_typed_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/function_type_missing_throws/negative.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_bound_patterns/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_rigid_coverage/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/match_exhaustiveness/match_exhaustiveness.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.baml
  • baml_language/crates/baml_tests/tests/comparable_sort.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_tests/tests/interfaces_associated_types.rs
  • baml_language/crates/baml_tests/tests/match_union_typevar.rs
  • baml_language/crates/baml_type/src/family.rs
  • baml_language/crates/baml_type/src/template.rs
  • baml_language/crates/baml_type_runtime/src/lib.rs
  • baml_language/crates/bex_vm/src/package_baml/json.rs
  • baml_language/crates/bex_vm/src/package_baml/resolve.rs
  • baml_language/crates/bex_vm/src/type_match.rs
  • baml_language/crates/bex_vm/src/vm.rs
🚧 Files skipped from review as they are similar to previous changes (48)
  • baml_language/crates/baml_tests/projects/diagnostic_errors/function_type_missing_throws/negative.baml
  • baml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.baml
  • baml_language/crates/baml_lsp2_actions/src/check.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_rigid_coverage/main.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/alias_bounds/alias_bounds.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/fn_typed_patterns/main.baml
  • baml_language/crates/bex_vm/src/package_baml/json.rs
  • baml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.baml
  • baml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.baml
  • baml_language/crates/baml_tests/baml_src/ns_interfaces/interfaces_3.baml
  • baml_language/crates/baml_compiler2_ppir/src/ty.rs
  • baml_language/crates/baml_tests/tests/match_union_typevar.rs
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_typevar/generic_match_typevar.baml
  • baml_language/crates/baml_type_runtime/src/lib.rs
  • baml_language/crates/baml_compiler2_tir/src/infer_context.rs
  • baml_language/crates/baml_tests/baml_src/ns_match_self_workaround/match_self_workaround.baml
  • baml_language/crates/baml_compiler2_emit/src/stack_carry.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/generic_bound_patterns/main.baml
  • baml_language/crates/baml_compiler_diagnostics/src/diagnostic.rs
  • baml_language/crates/baml_tests/baml_src/ns_iter_closure_elements/iter_closure_elements.baml
  • baml_language/crates/baml_tests/baml_src/ns_generic_match_rigid/generic_match_rigid.baml
  • baml_language/crates/baml_tests/projects/diagnostic_errors/match_exhaustiveness/match_exhaustiveness.baml
  • baml_language/crates/baml_tests/tests/comparable_sort.rs
  • baml_language/crates/baml_tests/tests/interfaces.rs
  • baml_language/crates/baml_compiler2_tir/src/builder/associated_projection.rs
  • baml_language/crates/baml_tests/baml_src/ns_projection_patterns/projection_patterns.baml
  • baml_language/crates/baml_tests/baml_src/ns_match_call_scrutinee/match_call_scrutinee.baml
  • baml_language/crates/baml_compiler2_ppir/src/expand.rs
  • baml_language/crates/baml_tests/projects/diagnostic_errors/self_in_body/main.baml
  • baml_language/crates/bex_vm/src/package_baml/resolve.rs
  • baml_language/crates/baml_tests/projects/compiles/patterns_new/patterns_new.baml
  • baml_language/crates/baml_tests/tests/interfaces_associated_types.rs
  • baml_language/crates/bex_vm/src/type_match.rs
  • baml_language/crates/baml_tests/baml_src/ns_match_container_types/match_container_types.baml
  • baml_language/crates/baml_compiler2_mir/src/pretty.rs
  • baml_language/crates/baml_compiler2_tir/src/pattern_overlap.rs
  • baml_language/crates/baml_tests/baml_src/ns_self_frame_slot/self_frame_slot.baml
  • baml_language/crates/baml_compiler2_tir/src/interfaces.rs
  • baml_language/crates/baml_type/src/family.rs
  • baml_language/crates/baml_compiler2_tir/src/inference.rs
  • baml_language/crates/baml_type/src/template.rs
  • baml_language/crates/baml_compiler2_tir/src/exhaustiveness.rs
  • baml_language/crates/baml_compiler2_tir/src/interfaces/impl_rules.rs
  • baml_language/crates/baml_compiler2_emit/src/lib.rs
  • baml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/patterns_new.baml
  • baml_language/crates/baml_compiler2_emit/src/emit.rs
  • baml_language/crates/baml_compiler2_mir/src/lower.rs
  • baml_language/crates/baml_compiler2_tir/src/builder.rs

@2kai2kai2
2kai2kai2 added this pull request to the merge queue Jul 27, 2026
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 27, 2026 02:12 Inactive
Merged via the queue into canary with commit 93c9f99 Jul 27, 2026
210 of 214 checks passed
@2kai2kai2
2kai2kai2 deleted the kai/split-template-ty branch July 27, 2026 02:22
meefs pushed a commit to meefs/baml that referenced this pull request Jul 29, 2026
Followup to BoundaryML#4203
We can now get the concrete type of a function-typed value and match on
it:
- Some fixes to the validation of `requires`-bounds; they should match
other interface-bounds elsewhere
- The types on `Object::Function` now use `TyTemplate`, using De Bruijn
indices into the `GenericFunction`/`BoundMethod`/etc captured frame.
- Also fixed a bug where lambdas lost signature data in the MIR

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Function values (closures, generic functions, bound methods) can now
be matched using precise call signatures, improving runtime support for
`match`/`is` with function types.
* `reflect.signature` more accurately preserves inferred
parameter/return/throws typing.
* **Bug Fixes**
* Improved match exhaustiveness to avoid false missing-case witnesses,
including for `unknown` and class instantiations.
* Interface `requires` clauses are validated with better shape and
generic-arity diagnostics at the declaration site.
* “Never throws” is represented explicitly for more consistent typing
and diagnostics.
* **Tests**
* Added and updated regression coverage for callable matching,
reflection signatures, rigid patterns, iterator behavior, `requires`
validation, and `unknown` match exhaustiveness.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle — 62b3c556 Deployed Jul 27, 2026 by vercel[bot]
Preview – promptfiddle2 — 62b3c556 Deployed Jul 27, 2026 by vercel[bot]
Preview – beps — 62b3c556 Deployed Jul 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant