Skip to content

Add extra tests for various uncovered parts of the code - #64907

Open
Jake Bailey (jakebailey) wants to merge 14 commits into
microsoft:mainfrom
jakebailey:extra-tests-fw
Open

Jake Bailey (jakebailey) wants to merge 14 commits into
microsoft:mainfrom
jakebailey:extra-tests-fw

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Found these in a long session; none of this was being tested before.

It could be that some of this behavior is "not good", but we have no tests for them now.

Declaration emit serializes the types of JS expando assignments as if
they were declared in the namespace synthesized for the host function.
That scope decides whether existing annotations can be reused, so a
`unique symbol` annotation is emitted as `symbol`. No existing test
covered this.
A CommonJS module whose export assignment references `exports` is
reported as circular (TS7022), because the type resolution pushed for
the module.exports symbol is still on the stack. No existing test
covered this.
TS2729 for a static property read before it is initialized is suppressed
only when an earlier static block definitely assigns that property, as
decided by flow analysis. An empty or non-assigning static block must
not hide the error. No existing test covered this.
When a unique symbol used as a property name is reached through a re-
export, the module in its fully qualified name is printed with a
specifier relative to the containing file (`"./b".key`), not the
module's absolute path. No existing test covered this.
Whether a class extends null is decided from its resolved base
constructor type, so `const N = null; class A extends N {}` counts under
strictNullChecks and its constructor does not require a super call
(TS2377). Existing tests only cover a literal `extends null`.
An ambient const or readonly initializer may be a literal enum
reference, which is verified by checking that the expression's type is
enum-like. Other property and element accesses, such as `declare const x
= NS.v;`, must still report TS1254. No existing test covered this.
With importHelpers and emitDecoratorMetadata, TS2343 is reported when
the tslib in use lacks __metadata, since the emitted code would call a
helper that does not exist. No existing test covered the __metadata
case.
Accessing a missing property on a PromiseLike or user-defined thenable
reports TS2339, with the "Did you forget to use 'await'?" hint when the
promised type has the property. Existing tests only cover the global
Promise.
The contextual type of an await operand is a promise-like of the outer
contextual type, with `Awaited<T>` unwrapped. That changes what a
generic call in the operand infers: with a non-thenable constraint it
infers `T` and reports that `T` is not assignable to `Awaited<T>`. No
existing test covered this.
The elements of a spread tuple argument are checked like argument
expressions, including instantiating a single generic signature in
context, which changes the inferred return type of the call. No existing
test covered this.
`0n` is definitely falsy, so `x && "a"` with `x: 0n | 1n` keeps `0n` in
the result type. No existing test covered this.
Signature identity compares type predicates, so a redeclared variable
whose function type differs only in its predicate reports TS2403. No
existing test covered this.
When `a ?? b` or `a || b` initializes a binding pattern, the right
operand is contextually typed by the pattern's implied type rather than
the pattern itself, so literals in it are not widened. No existing test
covered this.
`never` distributes to no types, so two `[k: never]` index signatures
are not reported as duplicates (TS2374); only the invalid parameter type
error (TS1268) is. No existing test covered this.
Copilot AI balanced review requested due to automatic review settings October 21, 2026 17:52
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 21, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes only add regression fixtures and matching baselines, with no identified blocking issues.

No open issues 🎉

What changed in this PR

Adds 14 compiler regression fixtures and corresponding baselines to capture previously uncovered behavior without changing compiler implementation.

Changes:

  • Covers inference, symbol resolution, initialization, and diagnostic edge cases.
  • Adds JavaScript module and declaration-emission coverage.
  • Records expected types, symbols, diagnostics, and output, including configuration variants.
File Description
tsc/​testdata/​tests/​cases/​compiler/​uniqueSymbolPropertyNameFromReexportedModule.ts Tests reexported unique-symbol diagnostics.
tsc/​testdata/​tests/​cases/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks.ts Tests static initialization across field modes.
tsc/​testdata/​tests/​cases/​compiler/​spreadArgumentWithSingleGenericSignature.ts Tests generic inference through spread arguments.
tsc/​testdata/​tests/​cases/​compiler/​nullishAndLogicalOrRightOperandWithBindingPattern.ts Tests destructuring fallback inference.
tsc/​testdata/​tests/​cases/​compiler/​nonexistentPropertyOnThenable.ts Tests missing-property diagnostics on thenables.
tsc/​testdata/​tests/​cases/​compiler/​neverIndexSignatureNotDuplicate.ts Tests repeated never index signatures.
tsc/​testdata/​tests/​cases/​compiler/​moduleExportsSelfReferenceCircularity.ts Tests circular CommonJS export references.
tsc/​testdata/​tests/​cases/​compiler/​jsExpandoUniqueSymbolDeclarationEmit.ts Tests JavaScript expando declaration emission.
tsc/​testdata/​tests/​cases/​compiler/​importHelpersMissingMetadataHelper.ts Tests missing decorator metadata helpers.
tsc/​testdata/​tests/​cases/​compiler/​identicalSignaturesWithTypePredicates.ts Tests predicate signature identity.
tsc/​testdata/​tests/​cases/​compiler/​classExtendsNullValuedIdentifier.ts Tests null-valued bases across strictness modes.
tsc/​testdata/​tests/​cases/​compiler/​bigintZeroIsDefinitelyFalsy.ts Tests bigint-zero falsiness inference.
tsc/​testdata/​tests/​cases/​compiler/​awaitOperandContextualTypeUnwrapsAwaited.ts Tests contextual inference through await.
tsc/​testdata/​tests/​cases/​compiler/​ambientConstInitializerNonEnumReference.ts Tests ambient initializer restrictions.
tsc/​testdata/​baselines/​reference/​compiler/​uniqueSymbolPropertyNameFromReexportedModule.types Records reexported symbol types.
tsc/​testdata/​baselines/​reference/​compiler/​uniqueSymbolPropertyNameFromReexportedModule.symbols Records reexport symbol bindings.
tsc/​testdata/​baselines/​reference/​compiler/​uniqueSymbolPropertyNameFromReexportedModule.js Records reexport JavaScript output.
tsc/​testdata/​baselines/​reference/​compiler/​uniqueSymbolPropertyNameFromReexportedModule.errors.txt Records missing symbol-key diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=true).types Records define-mode static-field types.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=true).symbols Records define-mode field bindings.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=true).js Records define-mode field emission.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=true).errors.txt Records define-mode initialization diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=false).types Records assignment-mode static-field types.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=false).symbols Records assignment-mode field bindings.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=false).js Records assignment-mode field emission.
tsc/​testdata/​baselines/​reference/​compiler/​staticPropertyUsedBeforeInitializationWithStaticBlocks(usedefineforclassfields=false).errors.txt Records assignment-mode initialization diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​spreadArgumentWithSingleGenericSignature.types Records inferred spread-call result types.
tsc/​testdata/​baselines/​reference/​compiler/​spreadArgumentWithSingleGenericSignature.symbols Records generic spread-call bindings.
tsc/​testdata/​baselines/​reference/​compiler/​nullishAndLogicalOrRightOperandWithBindingPattern.types Records fallback literal-union inference.
tsc/​testdata/​baselines/​reference/​compiler/​nullishAndLogicalOrRightOperandWithBindingPattern.symbols Records destructuring symbol bindings.
tsc/​testdata/​baselines/​reference/​compiler/​nonexistentPropertyOnThenable.types Records thenable property-access types.
tsc/​testdata/​baselines/​reference/​compiler/​nonexistentPropertyOnThenable.symbols Records thenable symbol bindings.
tsc/​testdata/​baselines/​reference/​compiler/​nonexistentPropertyOnThenable.js Records thenable-access emission.
tsc/​testdata/​baselines/​reference/​compiler/​nonexistentPropertyOnThenable.errors.txt Records missing-property and await suggestions.
tsc/​testdata/​baselines/​reference/​compiler/​neverIndexSignatureNotDuplicate.types Records never index parameter types.
tsc/​testdata/​baselines/​reference/​compiler/​neverIndexSignatureNotDuplicate.symbols Records index-signature bindings.
tsc/​testdata/​baselines/​reference/​compiler/​neverIndexSignatureNotDuplicate.js Records interface erasure.
tsc/​testdata/​baselines/​reference/​compiler/​neverIndexSignatureNotDuplicate.errors.txt Records invalid index-type diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsSelfReferenceCircularity.types Records circular export inference.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsSelfReferenceCircularity.symbols Records circular export bindings.
tsc/​testdata/​baselines/​reference/​compiler/​moduleExportsSelfReferenceCircularity.errors.txt Records export circularity diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​jsExpandoUniqueSymbolDeclarationEmit.types Records expando symbol widening.
tsc/​testdata/​baselines/​reference/​compiler/​jsExpandoUniqueSymbolDeclarationEmit.symbols Records expando property bindings.
tsc/​testdata/​baselines/​reference/​compiler/​jsExpandoUniqueSymbolDeclarationEmit.js Records emitted expando declarations.
tsc/​testdata/​baselines/​reference/​compiler/​importHelpersMissingMetadataHelper.types Records decorator fixture types.
tsc/​testdata/​baselines/​reference/​compiler/​importHelpersMissingMetadataHelper.symbols Records decorator and helper bindings.
tsc/​testdata/​baselines/​reference/​compiler/​importHelpersMissingMetadataHelper.js Records imported metadata helper calls.
tsc/​testdata/​baselines/​reference/​compiler/​importHelpersMissingMetadataHelper.errors.txt Records missing __metadata diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​identicalSignaturesWithTypePredicates.types Records predicate declaration types.
tsc/​testdata/​baselines/​reference/​compiler/​identicalSignaturesWithTypePredicates.symbols Records merged declaration bindings.
tsc/​testdata/​baselines/​reference/​compiler/​identicalSignaturesWithTypePredicates.errors.txt Records incompatible redeclaration diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=true).types Records strict null-base inference.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=true).symbols Records strict null-base bindings.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=true).js Records strict null-base emission.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=true).errors.txt Records strict constructor diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=false).types Records non-strict null-base inference.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=false).symbols Records non-strict null-base bindings.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=false).js Records non-strict null-base emission.
tsc/​testdata/​baselines/​reference/​compiler/​classExtendsNullValuedIdentifier(strict=false).errors.txt Records non-strict constructor diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​bigintZeroIsDefinitelyFalsy.types Records bigint logical-expression inference.
tsc/​testdata/​baselines/​reference/​compiler/​bigintZeroIsDefinitelyFalsy.symbols Records bigint fixture bindings.
tsc/​testdata/​baselines/​reference/​compiler/​awaitOperandContextualTypeUnwrapsAwaited.types Records contextual await inference.
tsc/​testdata/​baselines/​reference/​compiler/​awaitOperandContextualTypeUnwrapsAwaited.symbols Records await fixture bindings.
tsc/​testdata/​baselines/​reference/​compiler/​awaitOperandContextualTypeUnwrapsAwaited.errors.txt Records Awaited<T> assignment diagnostics.
tsc/​testdata/​baselines/​reference/​compiler/​ambientConstInitializerNonEnumReference.types Records ambient initializer types.
tsc/​testdata/​baselines/​reference/​compiler/​ambientConstInitializerNonEnumReference.symbols Records ambient reference bindings.
tsc/​testdata/​baselines/​reference/​compiler/​ambientConstInitializerNonEnumReference.errors.txt Records disallowed ambient initializer diagnostics.

Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

2 participants