Refactor type checker for series and overloads

Introduce `unify_matched_overload` to handle type variable propagation
for overloaded functions. This ensures that when an overload is chosen,
its concrete parameter types are unified with the actual argument types.
This is crucial for resolving type variables nested within closures
called through overloaded functions.

Additionally, this commit:
- Allows `series` to infer schema type from `push` calls, simplifying
  its signature.
- Adds a fallback to `ValueSeries` in `rtl::series` if schema injection
  fails.
- Updates `StaticType::TypeVar` to return `Any` when accessed,
  simplifying field access logic.
- Adjusts tests to reflect the simplified `series` signature.
This commit is contained in:
2026-03-28 14:03:48 +01:00
parent d2cba2d55d
commit d7d1aef8ed
5 changed files with 150 additions and 67 deletions
+2 -2
View File
@@ -142,7 +142,7 @@ fn test_optimizer_inlining_slot_clash_repro() {
(do
(def outer (fn [length]
(do
(def history (series 100 :float))
(def history (series 100))
(fn [val] length)
)
))
@@ -164,7 +164,7 @@ fn test_reproduce_inlining_slot_clash_crash() {
(def MY_SMA
(fn [length]
(do
(def history (series 100 :float))
(def history (series 100))
(fn [val]
(do
(push history val)
+2 -2
View File
@@ -4,8 +4,8 @@ use myc::ast::types::Value;
#[test]
fn test_series_api_with_limit() {
let env = Environment::new();
// (series limit schema)
let source = "(series 100 {:price :float})";
// (series limit) — schema is inferred from push calls
let source = "(series 100)";
let result = env.compile(source).into_result();
assert!(result.is_ok(), "Series creation with limit should work: {:?}", result.err());
}