Repository navigation
own: a value moved into a field, an array or a constructor, then used, is a borrow of it; warn on a missing --own-facts file (TSLANG 50-53) - #848
Merged
Conversation
…ld; warn on a missing --own-facts file (TSLANG 50, 51) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…its last element (TSLANG 52) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of that field (TSLANG 53) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
DefaultLib main (3b49771), built with this branch's compiler (release, and debug with
The skips are the tests that run under gc only ( |
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 50-53, found by compiling every module of powder_sandbox's
-mm=ownbuild (native_ts_graphics fc6fe6c as its submodule) with the compiler from main. Write-ups are inTSLANG_ISSUES.md.own: a value moved on, then used, is a borrow of where it went
Under
-mm=owna value of the function's own that was moved somewhere and then used was refused, "used here after its value was moved". Each case now reads the value from its new place, read right after the move. That read is a borrow, which the existing checks follow through the calls in between with their facts. All three steps are inOwnershipSignatureFieldLocals.cpp, next to item 47's local-as-field reads.const layout = device.create(); this.layout = layout; if (!layout) ...; use(layout)(ntgcore/nri_donut_blit.ts). This covers stores in nested regions, and an object stored into aT | nullfield, which is read back narrowed. Strings, which are copied, andShared<T>handles, which are counted, are left as they were.this.textures.push(texture); this.views.push(texture.createView(...))(ntgcore/nri_donut_textures.ts). The value is read back asarray[newLength - 1].const app = new App(sample); sample.use(), andthis.frames.push(new Frame(viewSet)); viewSet.update(...). This applies only to a constructor in the module that stores the parameter as it is into a field nothing else in it writes, and wherethisdoesn't escape. The read goes through the object's latest place, so throughthis.frames[last]when the object was pushed.Anything that may release or overwrite the new place before the use is still refused, now as "borrows a field/an element but is used here after it may be released or overwritten". That covers an overwriting call, a
pop, an element store, the array replaced, or the object given away or overwritten. This also closes a hole alpha127 had: a value moved into a field of a parameter, with the parameter then given away into a field that is cleared, was accepted, and the program printed 0 from freed memory.51: a missing
--own-factsfile warnsA file named by
--own-factsthat doesn't exist was skipped without a word. Every call into that module was then taken to release anything, so the errors read as the program's own. powder_sandbox'sbuild-ownhad only 27 of the 58 facts objects its compile lines name. A missing file still gives no facts, but tslang now printswarning: --own-facts: '<file>' does not exist; ....Effect on powder_sandbox + native_ts_graphics under own (276 sources, every facts object built)
powder_sandbox's own
src/compiles clean with each step. Six ntg examples compile now:bokeh,calibrated_timestamps,shader_debugprintf,simple_compute,simple_hdr,simple_pbr.Also noted in
TSLANG_ISSUES.md, for native_ts_graphics rather than the compiler:examples/dynamic_primitive_clipping.ts:223passes aninttosetDepthClip(enable: boolean), which #846 rejects under every model. The fix isclip != 0.Tests
00tslang_issue_50.ts,00tslang_issue_52.tsand00tslang_issue_53.ts, under every model, JIT and compiled.own_err_moved_field_overwritten,own_err_moved_param_field_dropped,own_err_pushed_then_poppedandown_err_kept_by_constructor_reset.test-own-facts-missing-file.own_err_read_after_move_globalis still refused at all three of its sites, now with the borrow message.🤖 Generated with Claude Code