Repository navigation
Map and Set: @sharedElements; under -mm=own objects go in as Shared<T> - #41
Merged
Merged
Conversation
- @SharedElements on Map and Set: under -mm=own a key, value or element has to be a value, a string or a Shared<T> handle; a plain object or `any` is a compile error at the user's code that points at Shared<T>. Needs the compiler's @SharedElements check; the other memory models ignore it. - tests.ps1/tests.sh: a test whose first line starts with "// not own" is skipped under -mm=own; the untyped (Map<any, any>) map_* tests say so. - tests/map_shared.ts: Map and Set of Shared<T> - overwrite, get, entries, values, break, delete, union, intersection; counts given back under rc and own. 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.
Depends on ASDAlexander77/TypeScriptCompiler#697, which adds the compiler's
@sharedElementscheck. Merge that one first.Under
-mm=own, an object goes into aMaporSetasShared<T>. A plain object oranykey, value or element is now a compile error at the user's code that points atShared<T>, where it used to be errors insidelib.generics.ts.Changes
@sharedElementsonMapandSet. The other memory models ignore it.tests.ps1andtests.sh: a test whose first line starts with// not ownis skipped under-mm=own, beside the existing// gc only. The 8 untypednew Map()tests carry the marker:map_any,map_clear,map_entries,map_forEach,map_iterator,map_keys,map_size,map_values. An untypednew Map()isMap<any, any>, which own refuses, and own never compiled those tests. They still run under gc, rc and none.tests/map_shared.ts:MapandSetofShared<Node>, covering overwrite,get,entries,values,break,delete,unionandintersection. Under rc and own it checks that every count comes back.Tests
Run with the #697 compiler against a copy of the built library carrying this change:
map_*/set_*under own: the same 16 pass as before. The 8 marked tests fail with the new error instead of errors inside the library.map_sharedpasses under own, rc, gc and none, and under the JIT for own and rc.The full suites weren't run through
tests.ps1, and the library wasn't rebuilt from this branch.🤖 Generated with Claude Code