Skip to content

Commit eab824d

Browse files
Revert "Revert "Merge branch 'microsoft:main' into 60881""
This reverts commit 8933230.
1 parent 8933230 commit eab824d

46 files changed

Lines changed: 1043 additions & 74 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
name: coverage
9696
path: coverage
9797

98-
- uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
98+
- uses: codecov/codecov-action@0565863a31f2c772f9f0395002a31e3f06189574 # v5.4.0
9999
with:
100100
use_oidc: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork) }}
101101
disable_search: true
@@ -137,7 +137,7 @@ jobs:
137137
node-version: 'lts/*'
138138
- run: npm ci
139139

140-
- uses: actions/cache@0c907a75c2c80ebcb7f088228285e798b750cf8f # v4.2.1
140+
- uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
141141
with:
142142
path: ~/.cache/dprint
143143
key: ${{ runner.os }}-dprint-${{ hashFiles('package-lock.json', '.dprint.jsonc') }}

src/compiler/checker.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6207,6 +6207,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
62076207
const context = syntacticContext as NodeBuilderContext;
62086208
if (context.bundled || context.enclosingFile !== getSourceFileOfNode(lit)) {
62096209
let name = lit.text;
6210+
const originalName = name;
62106211
const nodeSymbol = getNodeLinks(parent).resolvedSymbol;
62116212
const meaning = parent.isTypeOf ? SymbolFlags.Value : SymbolFlags.Type;
62126213
const parentSymbol = nodeSymbol
@@ -6227,7 +6228,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
62276228
context.tracker.reportLikelyUnsafeImportRequiredError(name);
62286229
}
62296230
}
6230-
return name;
6231+
if (name !== originalName) {
6232+
return name;
6233+
}
62316234
}
62326235
},
62336236
canReuseTypeNode(context, typeNode) {
@@ -8831,10 +8834,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
88318834
return setTextRange(context, setEmitFlags(name, EmitFlags.NoAsciiEscaping), node);
88328835
}
88338836
const updated = visitEachChildWorker(node, c => attachSymbolToLeftmostIdentifier(c), /*context*/ undefined);
8834-
if (updated !== node) {
8835-
setTextRange(context, updated, node);
8836-
}
8837-
return updated;
8837+
return setTextRange(context, updated, node);
88388838
}
88398839
}
88408840

@@ -37319,6 +37319,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3731937319
if (file && fileExtensionIsOneOf(file.fileName, [Extension.Cts, Extension.Mts])) {
3732037320
grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
3732137321
}
37322+
if (compilerOptions.erasableSyntaxOnly) {
37323+
const start = node.type.pos - "<".length;
37324+
const end = skipTrivia(file.text, node.type.end) + ">".length;
37325+
diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
37326+
}
3732237327
}
3732337328
return checkAssertionWorker(node, checkMode);
3732437329
}

src/compiler/expressionToTypeNode.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,11 @@ export function createSyntacticTypeNodeBuilder(
435435
if (!resolver.canReuseTypeNode(context, node)) {
436436
return resolver.serializeExistingTypeNode(context, node);
437437
}
438+
const specifier = rewriteModuleSpecifier(node, node.argument.literal);
439+
const literal = specifier === node.argument.literal ? reuseNode(context, node.argument.literal) : specifier;
438440
return factory.updateImportTypeNode(
439441
node,
440-
factory.updateLiteralTypeNode(node.argument, rewriteModuleSpecifier(node, node.argument.literal)),
442+
literal === node.argument.literal ? reuseNode(context, node.argument) : factory.createLiteralTypeNode(literal),
441443
visitNode(node.attributes, visitExistingNodeTreeSymbols, isImportAttributes),
442444
visitNode(node.qualifier, visitExistingNodeTreeSymbols, isEntityName),
443445
visitNodes(node.typeArguments, visitExistingNodeTreeSymbols, isTypeNode),
@@ -612,10 +614,7 @@ export function createSyntacticTypeNodeBuilder(
612614

613615
function rewriteModuleSpecifier(parent: ImportTypeNode, lit: StringLiteral) {
614616
const newName = resolver.getModuleSpecifierOverride(context, parent, lit);
615-
if (newName) {
616-
return setOriginalNode(factory.createStringLiteral(newName), lit);
617-
}
618-
return visitNode(lit, visitExistingNodeTreeSymbols, isStringLiteral)!;
617+
return newName ? setOriginalNode(factory.createStringLiteral(newName), lit) : lit;
619618
}
620619
}
621620
}
@@ -1123,15 +1122,16 @@ export function createSyntacticTypeNodeBuilder(
11231122
);
11241123
}
11251124
function reuseTypeParameters(typeParameters: NodeArray<TypeParameterDeclaration> | undefined, context: SyntacticTypeNodeBuilderContext) {
1126-
return typeParameters?.map(tp =>
1127-
factory.updateTypeParameterDeclaration(
1125+
return typeParameters?.map(tp => {
1126+
const { node: tpName } = resolver.trackExistingEntityName(context, tp.name);
1127+
return factory.updateTypeParameterDeclaration(
11281128
tp,
11291129
tp.modifiers?.map(m => reuseNode(context, m)),
1130-
reuseNode(context, tp.name),
1130+
tpName,
11311131
serializeExistingTypeNodeWithFallback(tp.constraint, context),
11321132
serializeExistingTypeNodeWithFallback(tp.default, context),
1133-
)
1134-
);
1133+
);
1134+
});
11351135
}
11361136

11371137
function typeFromObjectLiteralMethod(method: MethodDeclaration, name: PropertyName, context: SyntacticTypeNodeBuilderContext, isConstContext: boolean) {

src/lib/es2017.sharedmemory.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ interface SharedArrayBuffer {
1111
* Returns a section of an SharedArrayBuffer.
1212
*/
1313
slice(begin?: number, end?: number): SharedArrayBuffer;
14-
readonly [Symbol.species]: SharedArrayBuffer;
1514
readonly [Symbol.toStringTag]: "SharedArrayBuffer";
1615
}
1716

1817
interface SharedArrayBufferConstructor {
1918
readonly prototype: SharedArrayBuffer;
2019
new (byteLength?: number): SharedArrayBuffer;
20+
readonly [Symbol.species]: SharedArrayBufferConstructor;
2121
}
2222
declare var SharedArrayBuffer: SharedArrayBufferConstructor;
2323

src/loc/lcl/chs/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15270,6 +15270,15 @@
1527015270
</Str>
1527115271
<Disp Icon="Str" />
1527215272
</Item>
15273+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15274+
<Str Cat="Text">
15275+
<Val><![CDATA[This expression is never nullish.]]></Val>
15276+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15277+
<Val><![CDATA[此表达式从不为 null。]]></Val>
15278+
</Tgt>
15279+
</Str>
15280+
<Disp Icon="Str" />
15281+
</Item>
1527315282
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1527415283
<Str Cat="Text">
1527515284
<Val><![CDATA[This expression is not callable.]]></Val>

src/loc/lcl/cht/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15270,6 +15270,15 @@
1527015270
</Str>
1527115271
<Disp Icon="Str" />
1527215272
</Item>
15273+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15274+
<Str Cat="Text">
15275+
<Val><![CDATA[This expression is never nullish.]]></Val>
15276+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15277+
<Val><![CDATA[此運算式一律不會是 nullish。]]></Val>
15278+
</Tgt>
15279+
</Str>
15280+
<Disp Icon="Str" />
15281+
</Item>
1527315282
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1527415283
<Str Cat="Text">
1527515284
<Val><![CDATA[This expression is not callable.]]></Val>

src/loc/lcl/csy/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15279,6 +15279,15 @@
1527915279
</Str>
1528015280
<Disp Icon="Str" />
1528115281
</Item>
15282+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15283+
<Str Cat="Text">
15284+
<Val><![CDATA[This expression is never nullish.]]></Val>
15285+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15286+
<Val><![CDATA[Tento výraz nikdy nemá hodnotu null.]]></Val>
15287+
</Tgt>
15288+
</Str>
15289+
<Disp Icon="Str" />
15290+
</Item>
1528215291
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1528315292
<Str Cat="Text">
1528415293
<Val><![CDATA[This expression is not callable.]]></Val>

src/loc/lcl/deu/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15264,6 +15264,15 @@
1526415264
</Str>
1526515265
<Disp Icon="Str" />
1526615266
</Item>
15267+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15268+
<Str Cat="Text">
15269+
<Val><![CDATA[This expression is never nullish.]]></Val>
15270+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15271+
<Val><![CDATA[Dieser binäre Ausdruck ist nie „NULLISH“.]]></Val>
15272+
</Tgt>
15273+
</Str>
15274+
<Disp Icon="Str" />
15275+
</Item>
1526715276
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1526815277
<Str Cat="Text">
1526915278
<Val><![CDATA[This expression is not callable.]]></Val>

src/loc/lcl/esn/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15282,6 +15282,15 @@
1528215282
</Str>
1528315283
<Disp Icon="Str" />
1528415284
</Item>
15285+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15286+
<Str Cat="Text">
15287+
<Val><![CDATA[This expression is never nullish.]]></Val>
15288+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15289+
<Val><![CDATA[Esta expresión nunca es nula.]]></Val>
15290+
</Tgt>
15291+
</Str>
15292+
<Disp Icon="Str" />
15293+
</Item>
1528515294
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1528615295
<Str Cat="Text">
1528715296
<Val><![CDATA[This expression is not callable.]]></Val>

src/loc/lcl/fra/diagnosticMessages/diagnosticMessages.generated.json.lcl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15282,6 +15282,15 @@
1528215282
</Str>
1528315283
<Disp Icon="Str" />
1528415284
</Item>
15285+
<Item ItemId=";This_expression_is_never_nullish_2881" ItemType="0" PsrId="306" Leaf="true">
15286+
<Str Cat="Text">
15287+
<Val><![CDATA[This expression is never nullish.]]></Val>
15288+
<Tgt Cat="Text" Stat="Loc" Orig="New">
15289+
<Val><![CDATA[Cette expression n’est jamais nulle.]]></Val>
15290+
</Tgt>
15291+
</Str>
15292+
<Disp Icon="Str" />
15293+
</Item>
1528515294
<Item ItemId=";This_expression_is_not_callable_2349" ItemType="0" PsrId="306" Leaf="true">
1528615295
<Str Cat="Text">
1528715296
<Val><![CDATA[This expression is not callable.]]></Val>

0 commit comments

Comments
 (0)