Repository navigation
-mm=own: values merged by ?: move; constant merges; an optional record's field is read - #873
Merged
Merged
Conversation
…s read Three "takes a second reference; cannot prove a move or a borrow here yet" shapes of the corpus (readiness item 3): - `return set ? n : undefined` (and `h.n = set ? n : null`) of an owned local: a branch into a merge whose value rc retains in its block now acquires the value (mergeRetainOf); the retain is the reference it moves into, and the release on the way that does not choose it goes on that edge (TSLANG 81's valueUnmovedEdges). Only when every way in brings null, undefined or a fresh value: a borrow brought in stays refused. - `object(true)?.v == "x"`: a field of an optional record merged with undefined and only read is a read of the record (fieldOnlyRead follows the merge), not a taker of the field. - `let pick: Node | null = on() ? mk(3) : null` at the top level: null seen through its cast is constant data, and a global initializer's retain of constant data takes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`return first ? shared : other` of two immortal globals, and `let v = typeof text === "string" ? 1 : "one"`, were refused as "merged from several branches; cannot prove which one owns it yet". When every way into the merge brings data (a literal, null), an immortal global's read or such a merge, the merged value owns nothing, and a retain of it takes nothing (mergeOwnsNothing). 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.
Readiness item 3, the "not yet" messages: four shapes from the corpus that own refused with "takes a second reference" or "merged from several branches", though their meaning under own is clear.
return set ? n : undefined,h.n = set ? n : nullof an owned localnmoves on the branch that chooses it; it is released on the other branchreturn first ? shared : other(globals never reassigned),typeof x === "string" ? 1 : "one"object(true)?.v == "x"(an optional object literal result)let pick: Node | null = on() ? mk(3) : nullat the top levelHow
ninto the merge's block argument now acquires it, when rc retains the merged value in that block (mergeRetainOf). That retain is the referencenmoves into. The release ofnon the branch that doesn't choose it goes on that edge, using the existing TSLANG 81 edge releases.set ? n : h.k) stays refused, because it would be given an owner.nafter the merge is reported as a use after a move.set ? n : mwith two locals lowers toarith.select, which has no edge to release the other value on, so it stays refused.mergeOwnsNothing).fieldOnlyReadnow follows the merge that?.makes withundefined, so a field that is only read is a read of the record.isConstantDatasees null and undefined through their casts, and a global initializer's retain of constant data takes nothing.Corpus
Every file in
tslang/test/tester/tests, compiled with--opt_level=3under gc and under own:The seven newly accepted files also run correctly under own. No file went from accepted to refused.
Validation
MALLOC_PERTURB_=165, tcache off)All three fuzzer crashes give identical IR with
main's compiler, so they are not regressions; they come next as their own batch:try/finallythat is never used captures a local; the local is freed early and read afterwards.f1(p5, (p6 = mk(6), p6)). It crashes only under Linux's poisoning allocator.finallyblock holds an interface view of it.Spec section 86 records the rules.
docs/own-readiness.mdhas the new measurement and the new shape rows.🤖 Generated with Claude Code