Remove IndexElementFn and series_element_type

The `IndexElementFn` trait and its associated `series_element_type`
function have been removed. The `TypeChecker` now directly inspects the
`StaticType::Series` variant to extract the element type when
propagating index constraints. This simplifies the type-checking logic
by removing an unnecessary layer of indirection and adhering to the
project rule of keeping the AST simple and pushing complexity into the
system.
This commit is contained in:
2026-03-29 14:00:48 +02:00
parent 0292ead7a5
commit 916460ab03
4 changed files with 12 additions and 44 deletions
-10
View File
@@ -35,16 +35,6 @@ pub trait InferenceAccess {
fn get_slot_type(&self, addr: Address<VirtualId>) -> StaticType;
}
/// Maps a concrete type to its element type for index-constraint propagation.
/// Called by `bind_var` when a TypeVar with an index constraint is bound.
///
/// Returns `Some(elem_ty)` if `ty` supports integer-index access (e.g. `Series`),
/// or `None` for all non-indexable types.
///
/// Register the appropriate implementation via `TypeChecker::new`. Each indexable
/// type (Series, and in future Stream) contributes a match arm here.
pub type IndexElementFn = fn(&StaticType) -> Option<StaticType>;
/// Called after the call's return type is resolved.
/// May replace the return type and/or perform unification side-effects (e.g. push).
pub type PostCallHook = fn(