Skip to content

@cpp overloads take a class for T | null and for its base class, in a partial resolve too - #577

Merged
ASDAlexander77 merged 2 commits into
mainfrom
cpp-overload-nullable-param
Oct 13, 2026
Merged

ASDAlexander77 merged 2 commits into
mainfrom
cpp-overload-nullable-param

Conversation

@ASDAlexander77

Copy link
Copy Markdown
Owner

TSLANG_ISSUES.md 19, found on pre-alpha101 in native_ts_graphics once tsbindgen started writing NVRHI's overloads under one name (#576): device.createGraphicsPipeline(Ref(desc), framebuffer) with framebuffer: IFramebuffer fit neither overload.

  • Class arguments: resolveCppOverload fitted an argument only by its own type, a number conversion, or canCastFromTo (tuples, interfaces). Now a class fits its own type and a T | null holding it as 3 (the same C++ pointer), and a base class, alone or in a union, as 2 (a derived-to-base conversion).
  • Partial resolve: the overload was picked in the full pass only. The partial resolve before it called the first overload with the arguments, and an argument it can't be cast to (a class for an s32) failed the function. Now the overload is picked in a partial resolve too; there, a call that fits none (or two) keeps the first overload without an error, and the full pass reports it.

Tests: 00cpp_overloads.ts covers a class, a T | null, and a derived class for T | null, plus a derived class picking its own overload over its base's. Full ctest (Release, Windows): 4085/4085 pass. docs/cpp-classes.md updated.

native_ts_graphics works around this with a IFramebuffer | null local in createGraphicsPipeline() until a release has this fix.

🤖 Generated with Claude Code

ASDAlexander77 and others added 2 commits October 13, 2026 22:05
… a partial resolve too

resolveCppOverload fitted an argument only by its own type, a number conversion or
canCastFromTo (tuples, interfaces): an IFramebuffer fit neither of NVRHI's
createGraphicsPipeline overloads, (Ref<GraphicsPipelineDesc>, Ref<FramebufferInfo>) and
(Ref<GraphicsPipelineDesc>, IFramebuffer | null), and a derived class no base class parameter.
Now a class fits its own type and a `T | null` holding it as 3 (the same C++ pointer), and a
base class, alone or in a union, as 2 (a derived-to-base conversion).

The overload was also picked in the full pass only: the partial resolve before it called the
first overload with the arguments, and an argument it can't be cast to (a class for an s32)
failed the function. It is picked in a partial resolve too; there, a call that fits none (or
two) keeps the first overload without an error and the full pass reports it.

00cpp_overloads.ts: a class, a `T | null` and a derived class for `T | null`, and a derived class
choosing its own overload over its base's. TSLANG_ISSUES.md 19; docs/cpp-classes.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ASDAlexander77
ASDAlexander77 merged commit 8ecfbe1 into main Oct 13, 2026
2 checks passed
@ASDAlexander77
ASDAlexander77 deleted the cpp-overload-nullable-param branch October 13, 2026 21:29
ASDAlexander77 added a commit that referenced this pull request Oct 17, 2026
All 19 issues are fixed on main; the section of fixes after pre-alpha97
is no longer headed "Open".

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