Skip to content

TSLANG_ISSUES 13: generic inference through Ref<T> and union members by type - #572

Merged
ASDAlexander77 merged 1 commit into
mainfrom
fix-generic-ref-inference
Oct 13, 2026
Merged

ASDAlexander77 merged 1 commit into
mainfrom
fix-generic-ref-inference

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG_ISSUES.md 13: a generic function's T wasn't inferred from an argument of a generic tuple alias (Vec<T> = [first: Ref<T> | null, last: Ref<T> | null]).

  • Inference had no case for Ref<T>, so even a plain f<T>(r: Ref<T>) failed. Added tryInferRef.
  • Union to union was matched member by member in order, so T | null against Item | null could bind T = null. Members both unions share now bind nothing and the rest are paired; the old positional pairing is kept when the leftover counts differ.

Test: 00generic_ref_inference.ts (the issue's count(v), a plain Ref<T> parameter, [value: T | null]).

Full Release suite with all six TSLANG_ISSUES fixes together: 4074/4074.

🤖 Generated with Claude Code

A generic function's T was not inferred from an argument of a generic
tuple alias holding references (`Vec<T> = [first: Ref<T> | null, ...]`):
inference had no case for Ref<T>, not even for a plain `Ref<T>`
parameter. Also, two unions were matched member by member in order, so
`T | null` against `Item | null` could bind T to null; members both
unions have now bind nothing, and the rest are paired.

Found writing stdVectorSize<T> for native_ts_graphics' NVRHI bindings
(TSLANG_ISSUES.md 13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 2ce9a15 into main Oct 13, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the fix-generic-ref-inference branch October 13, 2026 17:08
ASDAlexander77 added a commit that referenced this pull request Oct 13, 2026
13, 14, 15 and 18 are fixed by #572, #568, #570 and #569. For 16, `%` is
fixed by #571 and `/` stays a number. 17 is answered (`Deref(p[i]) = v`
stores) and its error names that form since #573. 5 and 6 stay open:
they are design questions, not bugs.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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