Repository navigation
x[k] and k in x of a value of type any, through a keys adapter in the type descriptor - #940
Merged
Merged
Conversation
… a keys adapter in the type descriptor (TYPE_DESCR_KEYS); a constant array is boxed as the array it makes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e: made inside it, it was never recorded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… value was boxed (an arrow, a generic being inferred) they were made twice or used the enclosing function's values; writing x[k] of an any says it is not supported; own keeps the constant-key message Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…'s generation, before clearTempModule: made after it, their parameters were left unlowered (LLVM Translation failed; Map/Set default library tests) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…runner skips tests marked // not rc under -mm=rc, as tests.ps1 does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns what it is given; it borrowed, and a caught value kept in one past its catch clause was thrown freed (DisposableStack on wasm) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… own, which refuses its copy of an any holding an object by design (ctest runs it under gc, rc and none) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 19, 2026
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.
x[k]andk in xof a value of typeany, looked up at run time (user ruling 11-19). Follow-up to #939.How
TYPE_DESCR_KEYS(index 6; the block header moves to 7). It holds an adapter(box: any, op: number, key: any, value: any) => anyfor each tuple, object literal, class, interface or array type boxed intoany. The boxing records the type; the adapters are made once the module's statements and entry code are generated. Made at the boxing site itself (inside an arrow, or a generic being inferred), they were generated twice or used the enclosing function's values. Op 0 readsbox[key]; op 1 answerskey in box.valueis reserved for a later write op, so adding one won't change the layout again.x[k]onanycalls__any_key(box, 0, key):lengthitself;undefined.lengthgives an array's length.k in xwithx: anygoes through the same adapter. So does a key known only at run time whenx's type knows its keys (an object literal, tuple, class or interface), which used to be "the key must be a constant".in, but reading one throws a TypeError.anyis now boxed as a real array.const a: any = [1, 2]; <number[]>aused to crash, on main as well.OwnedReturnConsumptionPasshandling). An rc leak probe (class and object literal boxed, fields and an array element read,in) stays flat at 61 MB from 300k to 3M iterations.-mm=ownyet: it's a clear compile error there, the same as calls ofanyin Call a value of type any through an adapter made when its function was boxed; checked casts from any to a function #922.Also fixed: wasm legs failing on the default library's new tests (DL #108)
ldexp/ldexpf. LLVM turnspow(2, e)into these, as inDataView.getFloat16(dataview.ts).// not rcmarker that tests.ps1 honours. finalization_registry_models.ts is built on WeakRef, which-mm=rcdoesn't have.letof a heap type declared without a value borrowed whatever it was given. InDisposableStack.dispose(),failure = ein a catch clause took no reference; the clause released the caught value, andthrow failurethrew a freed block. The wasm host's heap check caught the second free; natively it went unnoticed. Such aletnow starts empty and owns what it is given (not catch variables, which the landing pad writes). It is on main too, not caused by this PR. New test:00let_without_initializer_owns.test-rc-conditional-named-const-releasenow expects the value inside theifto be released there, since the outerletholds its own reference.Layout change
The descriptor record grew by one pointer. The default library, and the wasm and Android archives, have to be rebuilt with this compiler. A program built with it and linked against an older library reads that library's type tags at the wrong offset: the rc and own default-library tests fail that way.
Limits
x.name(dot access) onanyis still an error: the ruling coveredx[k]andin.any(x[k] = v,+=,++) give a clear error: "writing 'x[k]' of a value of type 'any' is not supported".undefined(the adapter reads only what code outside the class can read).s32[], so<number[]>of its box reads the wrong element width. That's an existing problem, not touched here.Tested
anyand then called, a program boxing default-library classes (TypeError, RangeError) linked against the rebuilt library on gc/rc (exe + jit, no duplicate symbols), and an rc/own leak loop of boxed constant arrays (flat).00any_keys(compile, jit, rc/none corpus);-mm=ownerror testscrash-errors/any_key.tsandcrash-errors/in_any.ts; write error testsany_key_assign,any_key_compound,any_key_increment.🤖 Generated with Claude Code