Repository navigation
own: a ?: of fresh values or null is the function's own; an array literal of fields, only read, borrows them (TSLANG 54, 55) - #849
Merged
Conversation
…body too (TSLANG 54) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 54 and 55, 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. The rules for 55 are in section 80 of the own design spec.54: a
?:of fresh values or null is the function's ownconst pipeline = loaded ? device.createPipelineFromDesc(layout, desc) : null; ... this.blitPipelines.push(pipeline)(ntgcore/nri_donut_textures.ts) was refused: "is merged from several branches; -mm=own cannot prove which one owns it yet".isFreshnow takes a merge block argument as fresh when every way in brings either a fresh value nothing else uses, or null or undefined (isFreshMerge, inOwnershipFacts.h). Nested?:are followed. A loop header, where a predecessor the block dominates comes back to it, is not covered.ownValue).checkReleasedOnceread the release at the end of one iteration as a second release of the next iteration's value.checkValueMovesread a move in the body as a move of a value made outside the loop. Both now take the argument as made where its block starts.c ? local : nullwithlocalused after, a merge moved twice, and a merge made before a loop and moved in it.55: an array literal of fields, only read, borrows them
const directions = [this.dir, this.dir, this.right, ...](ntgcore/donut_first_person_camera.ts),const pipelines = [this.a, this.b, this.c], andfor (const p of [this.a, this.b, extra])were refused: "borrows a field and cannot be stored".The new
classifyLocalBorrowingArrayshandles this case, next to spec 49'sclassifyArgumentArrays:CreateArrayheld in a local or used as it is, read only throughLengthOfandElementRef→Load. Each of its block-holding elements must be a read out of a place or out of a parameter's slot, and nothing may keep it (walkRecord).ReleaseandReleaseSlotare marked shallow.ReleaseSlotlowering gained a branch for that (emitReleaseArrayShallow), so the same field twice is fine.arrayElementUses, read bywalkBorrowed). A field written before such a use is still refused, as is a call that may write it. The array's own shallow release is not counted as a use.Effect on the sweep (276 sources, every facts object built)
this.options = [...], stores the array, so the refusal is correct.nri_donut_textures.tsis down to one error, which is ntg's own:new MipBlit(texture, ...)keepsthis.textures[t]a second time.donut_first_person_camera.tsis down to two errors: aletthat borrows a field and is then given a new array.src/compiles clean.Tests
00tslang_issue_54.tsand00tslang_issue_55.ts, under every model, JIT and compiled. 55 was also run as an exe by hand.own_err_merge_moved_twiceandown_err_borrowing_array_field_reset.tests.ps1passes for every model, release and debug, compiled and JIT, with no failures. Windows only.🤖 Generated with Claude Code