Skip to content

🐛 fix(mq-check): register ?? and .. as builtin operator overloads#1489

Merged
harehare merged 3 commits intomainfrom
fix/typechecker-coalesce-range-operators
Mar 24, 2026
Merged

🐛 fix(mq-check): register ?? and .. as builtin operator overloads#1489
harehare merged 3 commits intomainfrom
fix/typechecker-coalesce-range-operators

Conversation

@harehare
Copy link
Copy Markdown
Owner

No description provided.

Base automatically changed from feat/section-module-improvements to main March 24, 2026 05:41
The BinaryOp constraint generation looks up overloads via `symbol.value`
(the raw token string). `??` resolves to `"??"` and `..` to `".."`, but
builtins were only registered under `"coalesce"` and `"range"`, so
`resolve_overload` always returned None, leaving both operators untyped.

- Register `??` under both `"coalesce"` and `"??"` with two overloads:
  - `(None, a) -> a` for the null-coalescing case (`none ?? "default"`)
  - `(a, a) -> a` as same-type fallback
- Register `..` under `".."` as binary-only `(number, number) -> [number]`
  plus `(None, None) -> None` for None propagation
- Add integration tests for both operators
The `..` selector (Selector::Recursive) recursively collects all
descendant markdown nodes and returns them as an array. The type
checker was incorrectly returning Type::Markdown (same as `.h1` etc.)
instead of Type::array(Type::Markdown).

Fix both the piped-input path and the no-piped-input (top-level) path
in constraint generation to return [markdown] for Selector::Recursive.
@harehare harehare force-pushed the fix/typechecker-coalesce-range-operators branch from 5f52fbc to 204ff66 Compare March 24, 2026 05:41
…rized tests

Consolidate success and error cases into single rstest tables for
test_coalesce_operator, test_range_operator, and test_recursive_selector,
using a shared should_succeed: bool parameter.
@harehare harehare merged commit f978e5b into main Mar 24, 2026
4 checks passed
@harehare harehare deleted the fix/typechecker-coalesce-range-operators branch March 24, 2026 06:30
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