Skip to content

Revert "🤖 Pick PR #59285 (Fix captured shorthand properties i...) into release-5.5 (#59288)" #59305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49242,7 +49242,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const nodeLinks = getNodeLinks(node);
nodeLinks.calculatedFlags |= NodeCheckFlags.ConstructorReference | NodeCheckFlags.CapturedBlockScopedBinding | NodeCheckFlags.BlockScopedBindingInLoop;
if (isIdentifier(node) && isExpressionNode(node) && !(isPropertyAccessExpression(node.parent) && node.parent.name === node)) {
const s = getResolvedSymbol(node);
const s = getSymbolAtLocation(node, /*ignoreErrors*/ true);
if (s && s !== unknownSymbol) {
checkIdentifierCalculateNodeCheckFlags(node, s);
}
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3493,7 +3493,7 @@ export function isInExpressionContext(node: Node): boolean {
case SyntaxKind.ExpressionWithTypeArguments:
return (parent as ExpressionWithTypeArguments).expression === node && !isPartOfTypeNode(parent);
case SyntaxKind.ShorthandPropertyAssignment:
return ((parent as ShorthandPropertyAssignment).objectAssignmentInitializer ?? (parent as ShorthandPropertyAssignment).name) === node;
return (parent as ShorthandPropertyAssignment).objectAssignmentInitializer === node;
case SyntaxKind.SatisfiesExpression:
return node === (parent as SatisfiesExpression).expression;
default:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const obj = {

/** @type {string} */
lol
>lol : undefined
> : ^^^^^^^^^
>lol : string
> : ^^^^^^
}
lol = "string"
>lol = "string" : "string"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ export function makeNewChannel<T extends ChannelType>(type: T): NewChannel<Chann
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>type : T
> : ^
>localChannelId : "blahblahblah"
> : ^^^^^^^^^^^^^^
>localChannelId : string
> : ^^^^^^
}

const newTextChannel = makeNewChannel('text');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ function f15() {
> : ^^^^^^
>b4 : number
> : ^^^^^^
>c4 : true
> : ^^^^
>c4 : boolean
> : ^^^^^^^
}
var { a4, b4, c4 } = f15();
>a4 : string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ function f15() {
> : ^^^^^^
>b4 : number
> : ^^^^^^
>c4 : true
> : ^^^^
>c4 : boolean
> : ^^^^^^^
}
var { a4, b4, c4 } = f15();
>a4 : string
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/declarationsAndAssignments.types
Original file line number Diff line number Diff line change
Expand Up @@ -823,8 +823,8 @@ function f15() {
> : ^^^^^^
>b : number
> : ^^^^^^
>c : true
> : ^^^^
>c : boolean
> : ^^^^^^^
}

function f16() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const obj = {
> : ^^^^^^^^^^^^^^^
>{param2} : { param2: string; }
> : ^^^^^^^^^^^^^^^^^^^
>param2 : "value2"
> : ^^^^^^^^
>param2 : string
> : ^^^^^^
>{} : {}
> : ^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ module.exports = {
> : ^^^^^^^^^^^^^^^^^^^^^^^^^

customSymbol,
>customSymbol : unique symbol
> : ^^^^^^^^^^^^^
>customSymbol : symbol
> : ^^^^^^

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function f1() {
> : ^^^^^^^^^^^^^^^
>{ b } : { b: boolean; }
> : ^^^^^^^^^^^^^^^
>b : true
> : ^^^^
>b : boolean
> : ^^^^^^^

// Desired: OK
// 3.0: OK
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/shorthand-property-es5-es6.types
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ const bar = { foo, baz };
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo : any
> : ^^^
>baz : 42
> : ^^
>baz : number
> : ^^^^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/shorthand-property-es6-amd.types
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ const bar = { foo, baz };
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo : any
> : ^^^
>baz : 42
> : ^^
>baz : number
> : ^^^^^^

4 changes: 2 additions & 2 deletions tests/baselines/reference/shorthand-property-es6-es6.types
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ const bar = { foo, baz };
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^
>foo : any
> : ^^^
>baz : 42
> : ^^
>baz : number
> : ^^^^^^

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function foo () {
> : ^^^^^^^^^^^^^^^^^
>{ test } : { test: string; }
> : ^^^^^^^^^^^^^^^^^
>test : "test"
>test : string
> : ^^^^^^
}

Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function foo () {
> : ^^^^^^^^^^^^^^^^^
>{ test } : { test: string; }
> : ^^^^^^^^^^^^^^^^^
>test : "test"
>test : string
> : ^^^^^^
}

8 changes: 4 additions & 4 deletions tests/baselines/reference/systemObjectShorthandRename.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const x2 = {x}
> : ^^^^^^^^^^^^^^
>{x} : { x: string; }
> : ^^^^^^^^^^^^^^
>x : "X"
> : ^^^
>x : string
> : ^^^^^^

const a = {x2}
>a : { x2: { x: string; }; }
Expand All @@ -39,6 +39,6 @@ const b = {x3}
> : ^^^^^^^^^^^^^^^
>{x3} : { x3: string; }
> : ^^^^^^^^^^^^^^^
>x3 : "X"
> : ^^^
>x3 : string
> : ^^^^^^

This file was deleted.