Add Stream support for field accessors

The type checker now correctly handles unwrapping `Stream(T)` types for
lambda arguments.
A new `build_map_stream` function has been added to `rtl/streams.rs` to
facilitate field access on streams.
The `create-random-ohlc` function now returns a `Stream` instead of a
`Series`.
Examples have been updated to reflect these changes and demonstrate
stream usage.
This commit is contained in:
Michael Schimmel
2026-03-07 20:47:05 +01:00
parent 2023df2f62
commit f88992da61
6 changed files with 105 additions and 28 deletions
+3 -1
View File
@@ -422,9 +422,11 @@ impl TypeChecker {
let mut arg_types = Vec::with_capacity(inputs.len());
for input in inputs {
let typed_input = self.check_node(input, ctx, diag);
// Unwrap Series(T) to T for the lambda argument
// Unwrap Series(T) or Stream(T) to T for the lambda argument
let arg_ty = if let StaticType::Series(inner) = &typed_input.ty {
*inner.clone()
} else if let StaticType::Stream(inner) = &typed_input.ty {
*inner.clone()
} else {
StaticType::Any
};