conformance(#99 Track-1): lib-sensitive subset + measurement-integrity fix + 6 checker fixes (Pass 120→188)#1258
Merged
Merged
Conversation
Adds the two `toLocale{Lower,Upper}Case(locales?)` members to the string
built-in surface (they were absent entirely -> spurious TS2339) and widens
`localeCompare` from 1 to 3 params `(that, locales?, options?)` (a 2-arg
call was tripping TS2554). Mirrors the two new names into StringMemberNames
so the BuiltInApparentMembers invariant holds.
Purely additive (RequiredParams unchanged) so it can only remove spurious
errors. Flips the es2020 conformance test `localesObjectArgument.ts` from
6 spurious errors to clean.
First fix from the #99 Track-1 spurious-error triage (17 conformance tests
that tsc accepts but SharpTS wrongly flagged). Part of #80.
xUnit 15425/0; conformance baseline 31/31 no drift.
…s2016-2023) Adds the ES-version library folders (Symbols, es6/Symbols, es2016..es2023, esnext) to the conformance subset: 131 -> 296 tests. New committed buckets: 182 Pass / 75 Fail / 24 ParseError / 8 multi-file / 3 lib-drift / 3 directive / 1 TypeCheckError. This is the measurement-spike subset from the #99 pre-condition-2 work, now made permanent so Track-1 checker/parser fixes register as visible Fail->Pass flips and any regression hard-fails the baseline. The Fail and ParseError buckets are the known-state work-list, not passing tests. localesObjectArgument already lands Pass here (the just-committed String locale fix). Part of #80 / #99.
The table was stale (79 tests / 16 Pass, from the original 3-folder subset). Updates to the current committed buckets (296: 182 Pass / 75 Fail / 24 ParseError / 14 Skipped / 1 TypeCheckError) and folds in the #99 spike finding: lib.d.ts loading is an enabler, not the current pass-rate lever — checker breadth and parser gaps dominate the divergence.
… members
The non-primitive `object` type was only relatable to object/any/unknown,
so `object` was wrongly rejected against `{}` and all-optional shapes like
`{ t?: string }` (spurious TS2344 on a generic constraint). tsc treats
`object` as assignable to any target that requires nothing of it.
Broadens the `object`-as-source arm in TryRelateNeverUnknownObject to also
accept a Record whose fields are all optional and which has no call /
construct / index signatures (new HasNoRequiredMembers helper).
Second fix from the #99 Track-1 spurious-error triage. Flips the three
es2020 conformance tests bigintMissingES2019/ES2020/ESNext Fail -> Pass
(0 regressions, conformance Pass 182 -> 185). Part of #80.
xUnit 15425/0.
…elines Multi-target tests (`// @target: es2015, es2020, ...`) emit one baseline per target and NO plain `name.errors.txt`. ResolveBaselinePath only looked for the plain file, so these tests were scored against an empty baseline — any real diagnostic mis-counted as spurious, and (worse) a test where SharpTS produces nothing but tsc expects errors scored as a FALSE PASS. Adds newest-target resolution (es3 < es5 < es2015 < ... < esnext), matching SharpTS's single always-latest world model. 84 corpus tests / 6 in the current subset were affected. Exposes one hidden false pass: logicalAssignment5 (Pass -> Fail) — tsc reports 4 possibly-undefined errors on its `&&=` cases that SharpTS misses entirely. Honest Fail now; a real target for the deferred Cluster-A (logical-assignment narrowing) work. Part of #80 / #99.
…er typeof The typeof-in-type-position path (EvaluateTypeOf) resolves names via the TypeEnvironment, which doesn't carry the hard-coded ambient globals that expression-position LookupVariable knows — so `(typeof globalThis)[...]` threw a spurious TS2304. Resolves `globalThis` to `any` there (SharpTS's global model), and makes property access on `any` in a typeof path stay `any` (GetPropertyTypeForTypeOf) so the trailing index doesn't then TS7053. Third fix from the #99 Track-1 spurious-error triage. Flips globalThisTypeIndexAccess Fail -> Pass; three more globalThis tests move Fail -> Skipped:lib-drift (they were false-Fails from the spurious TS2304 — now honestly deferred as lib-drift). 0 regressions. Part of #80. xUnit 15425/0.
CheckLogicalAssign returned the un-narrowed declared type for every operator, so `(results ||= []).push(100)` and `(results ??= []).push(100)` — both valid TypeScript — were wrongly rejected as possibly-undefined. The value of `a OP= b` mirrors the binary `a OP b`: ||= -> Truthy(a) | b ??= -> NonNullish(a) | b &&= -> Falsy(a) | b Applies that narrowing (new NarrowLogicalTruthy / NarrowLogicalFalsy over union constituents; ExpandNonNullable for `??=`), so `||=`/`??=` drop undefined while `&&=` keeps it (still correctly flagged). Removes a real false-positive; foundation for the #99 Track-1 Cluster-A (logical-assignment) work. Does NOT yet flip the 5 logicalAssignment conformance tests — those additionally need cross-statement CFA narrowing (`x ??= []; x.push()`), `if (a op= b)` condition narrowing, and diagnostic codes aligned to tsc (TS2532/TS18048 vs our TS2533/TS2339) with never[] element handling (TS2345). Tracked as the residual Cluster-A effort. xUnit 15425/0; conformance baseline unchanged (no drift). Part of #80.
Non-optional property access on a nullable union always threw TS2533
("possibly null or undefined"), but tsc picks the code from which of
null/undefined the union actually carries and whether the receiver is a
bare identifier:
expression receiver: TS2531 (null) / TS2532 (undefined) / TS2533 (both)
identifier receiver: TS18047 / TS18048 / TS18049
Collapsing all six into TS2533 mismatched most strict-null baselines.
CheckGetOnUnion now threads the receiver expression and emits the matching
code (new NullableMemberAccessError). The message keeps the property name
(more actionable than tsc's bare form; conformance matches on code only).
Fourth #99 Track-1 fix. Flips logicalAssignment8 Fail -> Pass (its
`(results &&= ...).push()` receiver is undefined-only -> TS2532); the split
also aligns nullable-access codes corpus-wide. 0 regressions.
xUnit 15425/0; conformance Pass 185 -> 186. Part of #80.
A symbol index (`x[Symbol.species]`, `x[Symbol.toStringTag]`, ...) resolved to `any` only for Record/Interface/Instance/RegExp receivers; the built-in reference types (SharedArrayBuffer, ArrayBuffer, typed arrays, Map, Promise, Date, ...) fell through to a spurious TS7053. Well-known symbols are present on essentially every object, and SharpTS models symbol members loosely, so this widens the existing "symbol index -> any" arm via a shared IsSymbolIndexableObject predicate. #99 Track-1 Cluster B (well-known-symbol indexing). Flips es2017 useSharedArrayBuffer4 & useSharedArrayBuffer5 Fail -> Pass. 0 regressions. (symbolProperty18 still needs per-well-known-symbol member modeling on the WRITE index path; useSharedArrayBuffer2/3 are lib-drift, need #99 lib.d.ts.) xUnit 15425/0; conformance Pass 186 -> 188. Part of #80.
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.
Part of #80 (TS conformance epic) / #99 (Phase 1.5 lib.d.ts). This is the Track-1 checker-and-harness work that the #99 measurement spike identified as the actual near-term lever — see the spike comment on #99.
TL;DR
Committed baseline moves 120 → 188 Pass on the conformance subset. 9 commits: 1 subset expansion, 1 docs refresh, 1 harness-integrity fix, and 6 type-checker correctness fixes. Every checker change gated at xUnit 15,425/0 with 0 regressions.
Background: the spike (why this shape)
#99 asks to load
tsc'slib.*.d.tsinto the checker, but its own pre-conditions say quantify the problem first. I expanded the subset to the lib-sensitive folders (165 tests) and decomposed the failures: of 66 lib-folder Fails, ~17 were spurious (SharpTS emits an errortscdoesn't), a long tail were individual checker gaps, and only ~6 were true lib-version drift. Conclusion: lib.d.ts loading is not the current pass-rate lever — checker breadth is. So this PR does Track-1 checker fixes; #99 proper (the lib loader) stays deferred as an enabler (DOM/JSX, #88, removing the "Pass = coincidence" asterisk).What's in this PR
Scoreboard + docs
test(conformance): expand the subset to the lib-sensitive folders (Symbols,es6/Symbols,es2016–es2023,esnext) — 131 → 296 tests — so Track-1 fixes register as visibleFail→Passand regressions hard-fail.docs(status): refresh the stale STATUS.md §17 table + fold in the spike verdict.Harness integrity
test(conformance): resolve per-targetname(target=X).errors.txtbaselines. Multi-target tests emit one baseline per target and no plain file, so the runner was scoring 84 corpus tests against an empty baseline — mis-counting real diagnostics as spurious and hiding one outright false pass (logicalAssignment5). Now resolves the newest-target variant (matches SharpTS's always-latest world model).Type-checker correctness fixes (each flips real tests, gated full-suite green)
fix(types): StringtoLocaleLowerCase/toLocaleUpperCase+ widerlocaleComparearity. (+1)fix(types):objectis assignable to an object type with no required members ({},{ t?: string }) — was a spurious TS2344. (+3)fix(types):typeof globalThisin type position + property access onanyin a typeof path. (+1, and 3 more move to honest lib-drift)fix(types): compound logical-assignment value-type narrowing —(results ||= []).push()is valid TS SharpTS was wrongly rejecting. (foundation; removes a real false-positive)fix(types): nullable member-access diagnostic split — emittsc's actual code (TS2531/2532/2533 for expressions, TS18047/48/49 for identifiers) instead of collapsing everything to TS2533. Corpus-wide code alignment. (+1)fix(types): well-known-symbol indexing on built-in reference types (SharedArrayBuffer[Symbol.species], typed arrays, Map, Promise, …) — was a spurious TS7053. (+2)Verification
Explicitly out of scope (follow-ups, scoped in-branch commit messages + #99 notes)
logicalAssignment4/5/6/7): cross-statement CFA narrowing after a logical-assign,if (a op= b)condition narrowing, and[]→never[]element (TS2345). Deeper CFA work.symbolProperty18: the symbol write-index path + per-well-known-symbol member modeling.lib.*.d.ts(the ~6 remaining lib-drift Fails, e.g.useSharedArrayBuffer2/3, need this).