stdlib: format + remove baml.deep_equals + remove type.implementors - #4359
Conversation
|
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):
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (25)
📒 Files selected for processing (178)
💤 Files with no reviewable changes (5)
🚧 Files skipped from review as they are similar to previous changes (148)
📝 WalkthroughWalkthroughThe pull request reformats the BAML standard library and adds package manifests. It removes ChangesStandard library syntax and formatting
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
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_arrays/arrays.baml (1)
142-154: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winAssert on each
catchexpression inline.A
catchresult stored incaughtcan remain boxed in a test block.assert.equal(caught, expected_caught)can then fail even when the callback throws as expected. Pass eachcatchexpression directly to the assertion.
baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml#L142-L154: inline thesort_bycatch expression.baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml#L207-L217: inline thesort_by_keycatch expression.baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml#L222-L234: inline the no-write-backsort_by_keycatch expression.🤖 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_arrays/arrays.baml` around lines 142 - 154, Inline each catch expression directly in its assertion, replacing the intermediate caught/expected_caught test-block pattern for sort_by at baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml lines 142-154, sort_by_key at lines 207-217, and the no-write-back sort_by_key case at lines 222-234; preserve the existing array-result assertions.Source: Learnings
🧹 Nitpick comments (5)
baml_language/crates/baml_compiler2_ast/build.rs (4)
305-310: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueAdditional
@providers-no-options:annotations are dropped silently.The function keeps the first annotation only. If a second annotation is added later, its providers never reach
PROVIDER_CONFIGS, and no build error reports it. Flatten all matches, or assert that at most one annotation exists.♻️ Proposed change
fn extract_no_options_providers(file: &SyntaxNode) -> Vec<String> { provider_annotations(file, "`@providers-no-options`:") .into_iter() - .next() - .map_or_else(Vec::new, |(_, providers)| providers) + .flat_map(|(_, providers)| providers) + .collect() }🤖 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/build.rs` around lines 305 - 310, Update extract_no_options_providers to handle every `@providers-no-options`: annotation instead of selecting only the first match. Flatten and combine all provider lists returned by provider_annotations, or explicitly reject multiple matches with a build error while preserving the existing single-annotation behavior.
157-168: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffConsider making the extraction helpers unit-testable.
The build script now carries non-trivial parsing logic: annotation scanning, offset-based class association, and type normalization. Code in
build.rscannot be covered bycargo test --lib. Move these helpers into a module that the build script includes withinclude!and that the crate also compiles under#[cfg(test)], then add unit tests for the annotation-to-class association.Also run
cargo test --libfor the crates touched by this change.As per coding guidelines: "Prefer writing Rust unit tests over integration tests where possible" and "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/baml_compiler2_ast/build.rs` around lines 157 - 168, The parsing and extraction helpers in build.rs are not unit-testable through cargo test --lib. Move the annotation scanning, offset-based class association, and type-normalization helpers into a shared module, include that module from the build script with include!, and compile it under cfg(test) for the crate; add unit tests covering annotation-to-class association, then run cargo test --lib for each affected crate.Source: Coding guidelines
270-276: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winSort the class list instead of asserting the order.
debug_assert!is compiled out whendebug_assertionsare disabled, which happens for build scripts under a release profile. If the traversal order ever changes, the release build then binds annotations to the wrong class and emits a silently wrongPROVIDER_CONFIGStable. A sort makes the invariant hold in every profile at negligible cost.♻️ Proposed change
- let classes: Vec<(usize, String, ClassDef)> = file + let mut classes: Vec<(usize, String, ClassDef)> = file .descendants() .filter_map(ClassDef::cast) .filter_map(|class| { let name = class.name()?; Some(( usize::from(name.text_range().start()), name.text().to_string(), class, )) }) .collect(); - // `descendants` is a preorder walk, so the offsets come out ascending — - // which is what makes "first class whose name starts after the comment" - // the *nearest* following class rather than an arbitrary one. - debug_assert!( - classes.windows(2).all(|w| w[0].0 <= w[1].0), - "class name offsets must be in source order" - ); + // "First class whose name starts after the comment" is only the *nearest* + // following class if the offsets are ascending. `descendants` is a preorder + // walk and already yields them that way; the sort pins the invariant. + classes.sort_by_key(|(name_start, _, _)| *name_start);🤖 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/build.rs` around lines 270 - 276, Replace the debug_assert! ordering check in the class-list construction with an explicit sort by each class’s source offset (the first tuple element). Ensure sorting occurs before the subsequent annotation-to-class binding so release and debug builds consistently use source order; remove the assertion rather than retaining it as the primary safeguard.
212-222: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
field_type_textsilently returns an empty type.If
field.ty()isNone, the function returns"". Inassert_google_vertex_options_match, two fields that both lack a type then compare equal, so the Google/Vertex shape check passes on malformed input. A field without a type is unexpected here. Panic instead, in the same wayextract_class_shapepanics on a missing field name.♻️ Proposed change
-/// A field's declared type, whitespace-normalized onto one line. -fn field_type_text(field: &Field) -> String { - field.ty().map_or_else(String::new, |ty| { - ty.syntax() - .text() - .to_string() - .split_whitespace() - .collect::<Vec<_>>() - .join(" ") - }) -} +/// A field's declared type, whitespace-normalized onto one line. +fn field_type_text(field: &Field, class_name: &str) -> String { + let ty = field + .ty() + .unwrap_or_else(|| panic!("{class_name} has a field with no type")); + ty.syntax() + .text() + .to_string() + .split_whitespace() + .collect::<Vec<_>>() + .join(" ") +}🤖 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/build.rs` around lines 212 - 222, Update field_type_text to panic when field.ty() is None instead of returning an empty string, matching the missing-name behavior in extract_class_shape. Preserve the existing whitespace normalization for fields with a declared type so assert_google_vertex_options_match cannot treat two missing types as equal.baml_language/crates/baml_tests/baml_src/ns_instantiation_expr/instantiation_expr.baml (1)
30-34: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename the test to match the assertion.
Line 30 checks structural equality. The test name says
identical, which implies pointer identity. Rename the test so it does not claim coverage provided only bybaml_language/crates/baml_tests/tests/instantiation_interning.rs.Suggested test-name fix
-test "same_specialization_is_identical" { +test "same_specialization_compares_equal" {🤖 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_instantiation_expr/instantiation_expr.baml` around lines 30 - 34, Rename the test currently named same_specialization_is_identical to reflect that identity_same_specialization() asserts structural equality rather than pointer identity. Keep the assertion and test behavior unchanged.
🤖 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_tests/baml_src/ns_functions/functions.baml`:
- Line 7: Update the comment near the scalar/primitive return tests to
accurately state that scalar and instance results use assert.equal, while
boolean results use assert.is_true.
In `@baml_language/crates/baml_tests/baml_src/ns_operators/operators.baml`:
- Around line 116-118: Update the equal test to assert a true equality case
using the == operator instead of the current 1 != 2 expression. Preserve the
separate inequality assertion at the later line.
---
Outside diff comments:
In `@baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml`:
- Around line 142-154: Inline each catch expression directly in its assertion,
replacing the intermediate caught/expected_caught test-block pattern for sort_by
at baml_language/crates/baml_tests/baml_src/ns_arrays/arrays.baml lines 142-154,
sort_by_key at lines 207-217, and the no-write-back sort_by_key case at lines
222-234; preserve the existing array-result assertions.
---
Nitpick comments:
In `@baml_language/crates/baml_compiler2_ast/build.rs`:
- Around line 305-310: Update extract_no_options_providers to handle every
`@providers-no-options`: annotation instead of selecting only the first match.
Flatten and combine all provider lists returned by provider_annotations, or
explicitly reject multiple matches with a build error while preserving the
existing single-annotation behavior.
- Around line 157-168: The parsing and extraction helpers in build.rs are not
unit-testable through cargo test --lib. Move the annotation scanning,
offset-based class association, and type-normalization helpers into a shared
module, include that module from the build script with include!, and compile it
under cfg(test) for the crate; add unit tests covering annotation-to-class
association, then run cargo test --lib for each affected crate.
- Around line 270-276: Replace the debug_assert! ordering check in the
class-list construction with an explicit sort by each class’s source offset (the
first tuple element). Ensure sorting occurs before the subsequent
annotation-to-class binding so release and debug builds consistently use source
order; remove the assertion rather than retaining it as the primary safeguard.
- Around line 212-222: Update field_type_text to panic when field.ty() is None
instead of returning an empty string, matching the missing-name behavior in
extract_class_shape. Preserve the existing whitespace normalization for fields
with a declared type so assert_google_vertex_options_match cannot treat two
missing types as equal.
In
`@baml_language/crates/baml_tests/baml_src/ns_instantiation_expr/instantiation_expr.baml`:
- Around line 30-34: Rename the test currently named
same_specialization_is_identical to reflect that identity_same_specialization()
asserts structural equality rather than pointer identity. Keep the assertion and
test behavior unchanged.
🪄 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: 0838bdfc-de4e-4e2d-9dea-30e73092fb55
⛔ Files ignored due to path filters (26)
baml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_assert_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_namespace_llm.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_builtin_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_command_tests__render_testing_package_listing.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_render__tests__renders_builtin_class_with_impls.snapis excluded by!**/*.snapbaml_language/crates/baml_cli/src/snapshots/baml_cli__describe_render__tests__renders_user_items.snapis excluded by!**/*.snapbaml_language/crates/baml_surface/src/snapshots/baml_surface__export_tests__assert_package_exports_fully.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/comparable_sort.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/deep_copy.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/fs.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/instantiation_expr.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/interfaces.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/interfaces_associated_types.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/iter.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/parse_companions.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/streaming_sse_primitives.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/baml_src/type_reflection.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/__testing_std__/baml_tests__compiles____testing_std____03_ppir.snapis excluded by!**/*.snapbaml_language/crates/baml_tests/snapshots/compiles/__testing_std__/baml_tests__compiles____testing_std____04_tir.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!**/*.snap
📒 Files selected for processing (159)
baml_language/crates/baml_builtins2/baml_std/assert/assert.bamlbaml_language/crates/baml_builtins2/baml_std/assert/baml.tomlbaml_language/crates/baml_builtins2/baml_std/baml/baml.tomlbaml_language/crates/baml_builtins2/baml_std/baml/bigint.bamlbaml_language/crates/baml_builtins2/baml_std/baml/comparable.bamlbaml_language/crates/baml_builtins2/baml_std/baml/containers.bamlbaml_language/crates/baml_builtins2/baml_std/baml/conversions.bamlbaml_language/crates/baml_builtins2/baml_std/baml/core.bamlbaml_language/crates/baml_builtins2/baml_std/baml/float.bamlbaml_language/crates/baml_builtins2/baml_std/baml/int.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_csv/csv.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_env/env.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_errors/error_context.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_errors/errors.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_errors/stack_trace.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_errors/unknown_error.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_fs/fs.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_future/future.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_glob/glob.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_host/host.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_http/http.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_http/server.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_id/id.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_io/io.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_iter/iter.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_json/json.bamlbaml_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_media/media.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_net/net.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_ops/comparison.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_ops/math.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_panics/panics.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_random/random.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_spawn/spawn.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_stream/stream.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_sys/sys.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/duration.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/instant.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/plaindate.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/plaindatetime.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/plaintime.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/timezone.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_time/zoneddatetime.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_toml/toml.bamlbaml_language/crates/baml_builtins2/baml_std/baml/ns_yaml/yaml.bamlbaml_language/crates/baml_builtins2/baml_std/baml/string.bamlbaml_language/crates/baml_builtins2/baml_std/baml/type_class.bamlbaml_language/crates/baml_builtins2/baml_std/baml/uint8array.bamlbaml_language/crates/baml_builtins2/baml_std/boundary/baml.tomlbaml_language/crates/baml_builtins2/baml_std/boundary/core.bamlbaml_language/crates/baml_builtins2/baml_std/boundary/ns_id/id.bamlbaml_language/crates/baml_builtins2/baml_std/log/baml.tomlbaml_language/crates/baml_builtins2/baml_std/log/log.bamlbaml_language/crates/baml_builtins2/baml_std/reflect/baml.tomlbaml_language/crates/baml_builtins2/baml_std/reflect/reflect.bamlbaml_language/crates/baml_builtins2/baml_std/testing/baml.tomlbaml_language/crates/baml_builtins2/baml_std/testing/registry.bamlbaml_language/crates/baml_builtins2/baml_std/testing/runners.bamlbaml_language/crates/baml_builtins2/baml_std/testing/types.bamlbaml_language/crates/baml_builtins2_codegen/src/codegen.rsbaml_language/crates/baml_builtins2_codegen/src/extract.rsbaml_language/crates/baml_compiler2_ast/Cargo.tomlbaml_language/crates/baml_compiler2_ast/build.rsbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/cancel_token.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/interfaces_sort_comparable.bamlbaml_language/crates/baml_lsp2_actions_tests/test_files/semantic_tokens/task_group.bamlbaml_language/crates/baml_tests/baml_src/ns_array_rest_binding/array_rest_binding.bamlbaml_language/crates/baml_tests/baml_src/ns_arrays/arrays.bamlbaml_language/crates/baml_tests/baml_src/ns_arrays/reductions.bamlbaml_language/crates/baml_tests/baml_src/ns_arrays/sort_comparable.bamlbaml_language/crates/baml_tests/baml_src/ns_arrays/sum.bamlbaml_language/crates/baml_tests/baml_src/ns_assignments/assignments.bamlbaml_language/crates/baml_tests/baml_src/ns_bigints/bigints.bamlbaml_language/crates/baml_tests/baml_src/ns_builtins/builtins.bamlbaml_language/crates/baml_tests/baml_src/ns_byte_strings/byte_strings.bamlbaml_language/crates/baml_tests/baml_src/ns_cancel_cascade/cancel_cascade.bamlbaml_language/crates/baml_tests/baml_src/ns_cancel_token/cancel_token.bamlbaml_language/crates/baml_tests/baml_src/ns_catch_arm_return/catch_arm_return.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_classes/classes.bamlbaml_language/crates/baml_tests/baml_src/ns_cleanup/cleanup.bamlbaml_language/crates/baml_tests/baml_src/ns_closures/closures.bamlbaml_language/crates/baml_tests/baml_src/ns_comparable_sort/comparable_sort.bamlbaml_language/crates/baml_tests/baml_src/ns_const_bindings/const_bindings.bamlbaml_language/crates/baml_tests/baml_src/ns_control_flow/control_flow.bamlbaml_language/crates/baml_tests/baml_src/ns_deep_copy/deep_copy.bamlbaml_language/crates/baml_tests/baml_src/ns_defer/defer.bamlbaml_language/crates/baml_tests/baml_src/ns_enums/enums.bamlbaml_language/crates/baml_tests/baml_src/ns_exceptions/exceptions.bamlbaml_language/crates/baml_tests/baml_src/ns_floats/floats.bamlbaml_language/crates/baml_tests/baml_src/ns_for_loops/for_loops.bamlbaml_language/crates/baml_tests/baml_src/ns_fs/fs.bamlbaml_language/crates/baml_tests/baml_src/ns_functions/functions.bamlbaml_language/crates/baml_tests/baml_src/ns_future_methods/future_methods.bamlbaml_language/crates/baml_tests/baml_src/ns_gc/gc.bamlbaml_language/crates/baml_tests/baml_src/ns_glob/glob.bamlbaml_language/crates/baml_tests/baml_src/ns_http_server/http_server.bamlbaml_language/crates/baml_tests/baml_src/ns_if_else/if_else.bamlbaml_language/crates/baml_tests/baml_src/ns_instantiation_expr/instantiation_expr.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_ints/ints.bamlbaml_language/crates/baml_tests/baml_src/ns_is_operator/is_operator.bamlbaml_language/crates/baml_tests/baml_src/ns_iter/iter.bamlbaml_language/crates/baml_tests/baml_src/ns_iter_impl_generics_only/iter.bamlbaml_language/crates/baml_tests/baml_src/ns_json_alias/json_alias.bamlbaml_language/crates/baml_tests/baml_src/ns_json_auto_derive/json_auto_derive.bamlbaml_language/crates/baml_tests/baml_src/ns_json_parse_stringify/json_parse_stringify.bamlbaml_language/crates/baml_tests/baml_src/ns_json_to_from_string/json_to_from_string.bamlbaml_language/crates/baml_tests/baml_src/ns_lambdas/lambdas.bamlbaml_language/crates/baml_tests/baml_src/ns_lexical_scoping/lexical_scoping.bamlbaml_language/crates/baml_tests/baml_src/ns_maps/maps.bamlbaml_language/crates/baml_tests/baml_src/ns_match_arm_break_continue/match_arm_break_continue.bamlbaml_language/crates/baml_tests/baml_src/ns_match_basics/match_basics.bamlbaml_language/crates/baml_tests/baml_src/ns_match_optimization/match_optimization.bamlbaml_language/crates/baml_tests/baml_src/ns_match_types/match_types.bamlbaml_language/crates/baml_tests/baml_src/ns_null_handling/null_handling.bamlbaml_language/crates/baml_tests/baml_src/ns_operators/operators.bamlbaml_language/crates/baml_tests/baml_src/ns_optional_function_parameters/optional_function_parameters.bamlbaml_language/crates/baml_tests/baml_src/ns_parse_companions/parse_companions.bamlbaml_language/crates/baml_tests/baml_src/ns_patterns_new_runtime/patterns_new_runtime.bamlbaml_language/crates/baml_tests/baml_src/ns_property_shorthand/property_shorthand.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_shell/shell.bamlbaml_language/crates/baml_tests/baml_src/ns_soundness/soundness.bamlbaml_language/crates/baml_tests/baml_src/ns_spawn_basic/spawn_basic.bamlbaml_language/crates/baml_tests/baml_src/ns_spawn_name_object/spawn_name_object.bamlbaml_language/crates/baml_tests/baml_src/ns_spawn_semantics/spawn_semantics.bamlbaml_language/crates/baml_tests/baml_src/ns_spawn_throws/spawn_throws.bamlbaml_language/crates/baml_tests/baml_src/ns_streaming_sse_primitives/streaming_sse_primitives.bamlbaml_language/crates/baml_tests/baml_src/ns_strings/strings.bamlbaml_language/crates/baml_tests/baml_src/ns_task_group/task_group.bamlbaml_language/crates/baml_tests/baml_src/ns_time/time.bamlbaml_language/crates/baml_tests/baml_src/ns_type_error_repro/type_error_repro.bamlbaml_language/crates/baml_tests/baml_src/ns_type_reflection/type_reflection.bamlbaml_language/crates/baml_tests/baml_src/ns_typed_inputs/typed_inputs.bamlbaml_language/crates/baml_tests/baml_src/ns_typed_outputs/typed_outputs.bamlbaml_language/crates/baml_tests/baml_src/ns_while_loops/while_loops.bamlbaml_language/crates/baml_tests/baml_src/ns_wildcard_type_inference/wildcard_type_inference.bamlbaml_language/crates/baml_tests/tests/instantiation_interning.rsbaml_language/crates/baml_tests/tests/interfaces.rsbaml_language/crates/baml_type_runtime/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/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_load.rsbaml_language/crates/bex_vm/src/vm.rsbaml_language/crates/bex_vm/tests/bigint_equality.rsbaml_language/crates/bex_vm/tests/deep_equals_bigint.rsbaml_language/crates/bex_vm/tests/load_type.rsbaml_language/crates/bex_vm/tests/ops_comparison.rstools/sdk-parity-lint/baml_src/baseline.bamltools/sdk-parity-lint/baml_src/render.baml
💤 Files with no reviewable changes (5)
- baml_language/crates/baml_builtins2_codegen/src/codegen.rs
- baml_language/crates/bex_vm/src/vm.rs
- baml_language/crates/baml_builtins2/baml_std/baml/type_class.baml
- baml_language/crates/bex_vm/src/package_load.rs
- baml_language/crates/bex_vm/src/package_baml/type_class.rs
It is now redundant as `==`/`baml.ops.Equals`/`baml.ops.equals_equals` performs deep equality and allows equality to be user-overridable.
Its implementation was incorrect, and there is no viable way to implement it as there are an unbounded number of generic type variations that could implement a given interface instantiation. While answering "does this type implement this interface" is usually tractable, attempting to enumerate all implementors is not.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
baml.deep_equalsin favor ofbaml.ops.Equalstype.implementorswhich attempted to enumerate all implementors of an interface, despite that being an intractable task (there are an unbounded number of generic variations of types that could implement a given interface)Summary by CodeRabbit
New Features
Changes
TypeValue.implementors()reflection method and related implementor enumeration behavior.Refactor
Tests