Repository navigation
own: name the overridable method a call reaches; immortal array globals; an array changed through a borrowing local (TSLANG 60-62) - #853
Merged
Conversation
…TSLANG 60) `this.props[i].tick(t)` (native_ts_graphics core/rtxpt_game.ts), where `Prop.tick` reaches a method of an exported class through `setNodeTransform`, ended borrows with no reason given: TSLANG 48 named the method only for a direct virtual call. The signature pass now finds the one overridable method a call's callees reach (markOverridableReached, when it is the only reason they may destroy anything) and the error notes it with the way to it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`[CUBE_VERTICES, PLANE_VERTICES]`, `return GREEN;` and `const p = CAMERA_POSITION;` over module and namespace arrays (native_ts_graphics examples) were refused as borrows of a mortal global: only a class-typed global could be immortal (own spec 25). An array global written once by its initializer is now one too; its header is the immortal block (marked only when mortal: a constant array's is in read-only data), and its elements are still freed when overwritten. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… of the borrow (TSLANG 62) `const model = this.refractionModel; model.push(0.0)` (native_ts_graphics examples) was refused as the local keeping the field's value: push, pop, unshift, shift and splice take the local's slot. The slot holds the field's array, so they are uses of the borrow (collectBorrowerUses). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
DefaultLib
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TSLANG_ISSUES 60, 61 and 62, found by compiling powder_sandbox's
-mm=ownbuild (native_ts_graphics as its submodule) with the compiler from main. Write-ups are inTSLANG_ISSUES.md.60: name the overridable method a call reaches where a borrow ends
const name = this.name; for (...) this.props[i].tick(t); ... name(ntgcore/rtxpt_game.ts) was refused with only "it may be released or overwritten here" at the call.Prop.tickcallssetNodeTransform, which calls a method of the exported, non-@finalGameWorld. Another module may override that method, so the call may destroy anything.markOverridableReached, breadth first through calls that may destroy anything, memoized per callee). The error gets a note: "'Prop.tick' calls 'setNodeTransform', which calls 'GameWorld.setGameNodeTransform'; that method may be overridden in another module by a method that does; '@Final' on the method, or on its class, says it is not".@finalon it is enough.MsvcRandom(41) andGameWorld(7), ntg's@finals to add.61: an array global nothing assigns is immortal
[CUBE_VERTICES, PLANE_VERTICES, CUBE_VERTICES],return GREEN;andconst p = CAMERA_POSITION;held across calls (ntg examples) were refused as borrows of a mortal global. So was a plainconst A = [1.0, 2.0]read into an array literal.G[i]used after that is refused.62: an array changed through a local that borrows its field
const model = this.refractionModel; ... model.push(0.0);(ntgexamples/ray_tracing_extended.tsand its NRI ports) was refused: "borrows a field and cannot be stored, returned or captured".push,pop,unshift,shiftandsplicetake the slot that holds the array's header, and that was taken as the local keeping the field's value.collectBorrowerUses).popand used after it; the field given another array before a use; the local returned.undefinedin TypeScript terms, as the array spec's ruling T4-D accepts for a parameter.Effect on the sweep (276 sources, every facts object built)
ptlas.ts,ray_tracing_reflection.ts,collision.ts,nvrhi_direct.ts,async_compute_bloom.ts,msaa.ts,texture_compression_comparison.ts.ray_tracing_reflection_nri.ts: 29 errors → 1.Tests
00tslang_issue_60.ts,00tslang_issue_61.tsand00tslang_issue_62.ts, under every model, JIT and compiled.own_err_overridable_reached,own_err_immortal_array_element_overwrittenandown_err_borrowed_array_pushed_returned.tests.ps1for each model is running; results to follow in a comment.🤖 Generated with Claude Code