Repository navigation
slice() and Promise.resolve()/reject() with no arguments, toLocaleString(locales, options), iteration type names - #113
Merged
Merged
Conversation
…caleString(locales, options) on arrays Library gaps TypeScript's compiler tests still hit: - String.prototype.slice: indexStart is optional and defaults to 0, so slice() copies the string (controlFlowWithIncompleteTypes). - Promise.resolve() gives a settled promise of nothing; Promise.reject() throws undefined, boxed in an any since undefined itself can't be thrown (modulePreserveTopLevelAwait1, asyncFunctionContextuallyTypedReturns). - Arrays (new), TypedArray and ConvertingTypedArray toLocaleString take locales and options (ToLocaleStringOptions), not applied: there is no locale data (arrayToLocaleStringES2015/2020). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ck_declarations) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…erator and the async ones
TypeScript code names these types (the compiler-tests sweep: "generic type Iterable/Generator/
AsyncGenerator can't be found"). Here they fit the generators this compiler makes:
- IteratorResult<T, TReturn> is an alias of IterateResult<T>: as an interface a generator's next()
did not match it.
- Iterable<T> / AsyncIterable<T> are objects with next(), as for...of takes them, not objects with
[Symbol.iterator]: a generator has none, and an interface Iterable<T> { next } declared in a
program merges with the library's (two compiler tests declare one).
- Generator<T, TReturn, TNext>, IterableIterator<T>, AsyncGenerator, AsyncIterableIterator,
AsyncIterator: next() of their own; TReturn and TNext are taken, not used.
Not yet, in the compiler: an array or a string as an Iterable<T>, a yielded int as a declared
number, next(value), return() and throw(); under -mm=own a generator of owned elements returned
as an interface declared outside the library.
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.
Library gaps that TypeScript's compiler-tests sweep (compiler repo,
scripts\tsc_compiler_tests.ps1) still hit.String.prototype.slice():indexStartis optional (default 0), inlib.d.ts(both places) and inlib.ts(__String.sliceand theStringwrapper class) —controlFlowWithIncompleteTypes.Promise.resolve()/Promise.reject()with no argument:resolve<T = undefined>(value?: T);reject(reason?)throwsundefinedboxed in anany(undefined itself can't be thrown) —modulePreserveTopLevelAwait1,asyncFunctionContextuallyTypedReturns.toLocaleString(locales?, options?)on arrays (new in__Array),TypedArrayandConvertingTypedArray, with aToLocaleStringOptionsinterface. Taken but not applied (no locale data) —arrayToLocaleStringES2015/ES2020.types/lib.types.d.ts:IteratorResult(an alias, so a generator'snext()matches it),Iterable,IterableIterator,Generator<T, TReturn, TNext>,AsyncIterator,AsyncIterable,AsyncIterableIterator,AsyncGenerator.Iterable/AsyncIterableare objects withnext()(what for...of takes), not[Symbol.iterator]: a program's owninterface Iterable<T> { next }merges with the library's, and the[Symbol.iterator]form broke compiler tests00funcs_typed_generic_iterator/01funcs_generic_iterator(both pass with this one).New tests:
string_slice_no_args,promise_no_args,array_toLocaleString,iteration_types.What those sweep tests still fail on is the compiler's (handed to the compiler repo): flow narrowing of
boolean | stringin a loop, a generic lambda as an argument, tuples without array methods, arrays/strings asIterable<T>, a yielded int vs a declaredGenerator<number>,next(value)/return()/throw(), and -mm=own generators typed as a non-library iterator interface of owned elements.Tested (Windows, compiler 3f5ca0f0 = latest batch build): library rebuilt release + debug;
tests.ps1for gc / rc / none / own, release and debug, compiled and JIT: all pass (gc 246/247, rc 241, none 242, own 234; the rest are the usual skips);check_declarations: every declaration matches.🤖 Generated with Claude Code