Repository navigation
An indexer's set: an imported class's gives up what it keeps, and the call has set's result (TSLANG 43) - #802
Merged
Merged
Conversation
… call has set's result (TSLANG 43)
- -mm=own: `obj[key] = value` on a class imported from a library calls `set` through
`Cast(SearchForAddressOfSymbol("C.set"))`; the signature pass now resolves that callee to the
declared function, so its @keeps/@Lends apply and the caller no longer frees what `set` kept
(double free, hang at exit).
- Every model: the call lowered for an indexer's `set` had no result even when `set` returns one
(`JsonValue.set(...): this`), so it disagreed with its callee and LLVM lowering crashed now and
then. It now has the setter's results, unused.
- -mm=own: a method returning `this` that declares `@keeps` keeps the `@lends("this")` its result
type implies, instead of being told to say `@lends`.
Tests: import_class_keeps_indexer.ts/export_class_keeps_indexer.ts (gc, rc, own; compiled and JIT),
00class_indexer_set_result.ts. Spec 78 note, spec 79.
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.
Fixes TSLANG_ISSUES item 43 and two bugs found with it.
43. An imported class's indexer
setthat keeps its value (-mm=own).bag[key] = valueon a classimported from a library calls
setthroughCast(SearchForAddressOfSymbol("C.set")), which thesignature pass did not resolve, so the call had no facts and the caller freed what
setkept: adouble free, and the program hung at exit. The callee now resolves to the function the module declares
by that name, so its
@keeps/@lendsapply as forbag.set(key, value)(spec 79).An indexer
setthat returns a value, under every model. The call lowered forobj[key] = valuehad no result even when
setreturns one (JsonValue.set(...): this), so it disagreed with thefunction it calls and lowering to LLVM crashed tslang.exe now and then (about 1 run in 5 with the
default library's
JsonValueindexer). The call now has the setter's results, unused.@keepswith: this(-mm=own). A method returningthisthat declares@keeps, called onlyin its module, was told to say
@lendstoo; it keeps the@lends("this")its result type implies.Tests:
import_class_keeps_indexer.ts+export_class_keeps_indexer.ts(gc, rc, own; compiled andJIT),
00class_indexer_set_result.ts. Full ctest locally 6913/6913; the default library withTypeScriptCompilerDefaultLib#86 and #87 passes under own, rc, gc and none.
Needed by ASDAlexander77/TypeScriptCompilerDefaultLib#87 (with #801).
🤖 Generated with Claude Code