-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Ignore computed name parents when looking up containing functions #62950
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
Open
Andarist
wants to merge
3
commits into
microsoft:main
Choose a base branch
from
Andarist:fix/containing-function-lookup
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| classStaticBlock29.ts(3,19): error TS18037: 'await' expression cannot be used inside a class static block. | ||
| classStaticBlock29.ts(4,19): error TS18037: 'await' expression cannot be used inside a class static block. | ||
| classStaticBlock29.ts(5,23): error TS18037: 'await' expression cannot be used inside a class static block. | ||
|
|
||
|
|
||
| ==== classStaticBlock29.ts (3 errors) ==== | ||
| class C { | ||
| static { | ||
| const o1 = { [await 1]: '' }; | ||
| ~~~~~~~ | ||
| !!! error TS18037: 'await' expression cannot be used inside a class static block. | ||
| const o2 = { [await 1]() { return ''; } }; | ||
| ~~~~~~~ | ||
| !!! error TS18037: 'await' expression cannot be used inside a class static block. | ||
| const o3 = { get [await 1]() { return ''; } }; | ||
| ~~~~~~~ | ||
| !!! error TS18037: 'await' expression cannot be used inside a class static block. | ||
| } | ||
| } | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| //// [tests/cases/conformance/classes/classStaticBlock/classStaticBlock29.ts] //// | ||
|
|
||
| === classStaticBlock29.ts === | ||
| class C { | ||
| >C : Symbol(C, Decl(classStaticBlock29.ts, 0, 0)) | ||
|
|
||
| static { | ||
| const o1 = { [await 1]: '' }; | ||
| >o1 : Symbol(o1, Decl(classStaticBlock29.ts, 2, 9)) | ||
| >[await 1] : Symbol([await 1], Decl(classStaticBlock29.ts, 2, 16)) | ||
|
|
||
| const o2 = { [await 1]() { return ''; } }; | ||
| >o2 : Symbol(o2, Decl(classStaticBlock29.ts, 3, 9)) | ||
| >[await 1] : Symbol([await 1], Decl(classStaticBlock29.ts, 3, 16)) | ||
|
|
||
| const o3 = { get [await 1]() { return ''; } }; | ||
| >o3 : Symbol(o3, Decl(classStaticBlock29.ts, 4, 9)) | ||
| >[await 1] : Symbol([await 1], Decl(classStaticBlock29.ts, 4, 16)) | ||
| } | ||
| } | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //// [tests/cases/conformance/classes/classStaticBlock/classStaticBlock29.ts] //// | ||
|
|
||
| === classStaticBlock29.ts === | ||
| class C { | ||
| >C : C | ||
| > : ^ | ||
|
|
||
| static { | ||
| const o1 = { [await 1]: '' }; | ||
| >o1 : { 1: string; } | ||
| > : ^^^^^^^^^^^^^^ | ||
| >{ [await 1]: '' } : { 1: string; } | ||
| > : ^^^^^^^^^^^^^^ | ||
| >[await 1] : string | ||
| > : ^^^^^^ | ||
| >await 1 : 1 | ||
| > : ^ | ||
| >1 : 1 | ||
| > : ^ | ||
| >'' : "" | ||
| > : ^^ | ||
|
|
||
| const o2 = { [await 1]() { return ''; } }; | ||
| >o2 : { 1(): string; } | ||
| > : ^^^^^^^^^^^^^^^^ | ||
| >{ [await 1]() { return ''; } } : { 1(): string; } | ||
| > : ^^^^^^^^^^^^^^^^ | ||
| >[await 1] : () => string | ||
| > : ^^^^^^^^^^^^ | ||
| >await 1 : 1 | ||
| > : ^ | ||
| >1 : 1 | ||
| > : ^ | ||
| >'' : "" | ||
| > : ^^ | ||
|
|
||
| const o3 = { get [await 1]() { return ''; } }; | ||
| >o3 : {} | ||
| > : ^^ | ||
| >{ get [await 1]() { return ''; } } : {} | ||
| > : ^^ | ||
| >[await 1] : string | ||
| > : ^^^^^^ | ||
| >await 1 : 1 | ||
| > : ^ | ||
| >1 : 1 | ||
| > : ^ | ||
| >'' : "" | ||
| > : ^^ | ||
| } | ||
| } | ||
|
|
44 changes: 44 additions & 0 deletions
44
tests/baselines/reference/staticPropertyAssignmentInherited1.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| //// [tests/cases/conformance/salsa/staticPropertyAssignmentInherited1.ts] //// | ||
|
|
||
| //// [staticPropertyAssignmentInherited1.js] | ||
| let v = Math.random() ? '' : Math.random() ? 0 : undefined; | ||
|
|
||
| class Base { | ||
| static value1 = v; | ||
| static value2 = v; | ||
| static value3 = v; | ||
| } | ||
|
|
||
| class Derived extends Base { | ||
| static { | ||
| this.value1 = 10; | ||
| this.value4 = { | ||
| [this.value2 = 20]: '' | ||
| } | ||
| this.value5 = { | ||
| get [this.value3 = 30]() { return ''; } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** @param {typeof Derived} cls */ | ||
| function test(cls) { | ||
| cls.value1; | ||
| cls.value2; | ||
| cls.value3; | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| //// [staticPropertyAssignmentInherited1.d.ts] | ||
| /** @param {typeof Derived} cls */ | ||
| declare function test(cls: typeof Derived): void; | ||
| declare let v: string | number | undefined; | ||
| declare class Base { | ||
| static value1: string | number | undefined; | ||
| static value2: string | number | undefined; | ||
| static value3: string | number | undefined; | ||
| } | ||
| declare class Derived extends Base { | ||
| } |
85 changes: 85 additions & 0 deletions
85
tests/baselines/reference/staticPropertyAssignmentInherited1.symbols
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| //// [tests/cases/conformance/salsa/staticPropertyAssignmentInherited1.ts] //// | ||
|
|
||
| === staticPropertyAssignmentInherited1.js === | ||
| let v = Math.random() ? '' : Math.random() ? 0 : undefined; | ||
| >v : Symbol(v, Decl(staticPropertyAssignmentInherited1.js, 0, 3)) | ||
| >Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
| >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >Math.random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >Math : Symbol(Math, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --)) | ||
| >random : Symbol(Math.random, Decl(lib.es5.d.ts, --, --)) | ||
| >undefined : Symbol(undefined) | ||
|
|
||
| class Base { | ||
| >Base : Symbol(Base, Decl(staticPropertyAssignmentInherited1.js, 0, 59)) | ||
|
|
||
| static value1 = v; | ||
| >value1 : Symbol(Base.value1, Decl(staticPropertyAssignmentInherited1.js, 2, 12)) | ||
| >v : Symbol(v, Decl(staticPropertyAssignmentInherited1.js, 0, 3)) | ||
|
|
||
| static value2 = v; | ||
| >value2 : Symbol(Base.value2, Decl(staticPropertyAssignmentInherited1.js, 3, 20)) | ||
| >v : Symbol(v, Decl(staticPropertyAssignmentInherited1.js, 0, 3)) | ||
|
|
||
| static value3 = v; | ||
| >value3 : Symbol(Base.value3, Decl(staticPropertyAssignmentInherited1.js, 4, 20)) | ||
| >v : Symbol(v, Decl(staticPropertyAssignmentInherited1.js, 0, 3)) | ||
| } | ||
|
|
||
| class Derived extends Base { | ||
| >Derived : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >Base : Symbol(Base, Decl(staticPropertyAssignmentInherited1.js, 0, 59)) | ||
|
|
||
| static { | ||
| this.value1 = 10; | ||
| >this.value1 : Symbol(Derived.value1, Decl(staticPropertyAssignmentInherited1.js, 9, 10)) | ||
| >this : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >value1 : Symbol(Derived.value1, Decl(staticPropertyAssignmentInherited1.js, 9, 10)) | ||
|
|
||
| this.value4 = { | ||
| >this.value4 : Symbol(Derived.value4, Decl(staticPropertyAssignmentInherited1.js, 10, 21)) | ||
| >this : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >value4 : Symbol(Derived.value4, Decl(staticPropertyAssignmentInherited1.js, 10, 21)) | ||
|
|
||
| [this.value2 = 20]: '' | ||
| >[this.value2 = 20] : Symbol([this.value2 = 20], Decl(staticPropertyAssignmentInherited1.js, 11, 19)) | ||
| >this.value2 : Symbol(Derived.value2, Decl(staticPropertyAssignmentInherited1.js, 12, 7)) | ||
| >this : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >value2 : Symbol(Derived.value2, Decl(staticPropertyAssignmentInherited1.js, 12, 7)) | ||
| } | ||
| this.value5 = { | ||
| >this.value5 : Symbol(Derived.value5, Decl(staticPropertyAssignmentInherited1.js, 13, 5)) | ||
| >this : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >value5 : Symbol(Derived.value5, Decl(staticPropertyAssignmentInherited1.js, 13, 5)) | ||
|
|
||
| get [this.value3 = 30]() { return ''; } | ||
| >[this.value3 = 30] : Symbol([this.value3 = 30], Decl(staticPropertyAssignmentInherited1.js, 14, 19)) | ||
| >this.value3 : Symbol(Derived.value3, Decl(staticPropertyAssignmentInherited1.js, 15, 11)) | ||
| >this : Symbol(Derived, Decl(staticPropertyAssignmentInherited1.js, 6, 1)) | ||
| >value3 : Symbol(Derived.value3, Decl(staticPropertyAssignmentInherited1.js, 15, 11)) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** @param {typeof Derived} cls */ | ||
| function test(cls) { | ||
| >test : Symbol(test, Decl(staticPropertyAssignmentInherited1.js, 18, 1)) | ||
| >cls : Symbol(cls, Decl(staticPropertyAssignmentInherited1.js, 21, 14)) | ||
|
|
||
| cls.value1; | ||
| >cls.value1 : Symbol(Derived.value1, Decl(staticPropertyAssignmentInherited1.js, 9, 10)) | ||
| >cls : Symbol(cls, Decl(staticPropertyAssignmentInherited1.js, 21, 14)) | ||
| >value1 : Symbol(Derived.value1, Decl(staticPropertyAssignmentInherited1.js, 9, 10)) | ||
|
|
||
| cls.value2; | ||
| >cls.value2 : Symbol(Derived.value2, Decl(staticPropertyAssignmentInherited1.js, 12, 7)) | ||
| >cls : Symbol(cls, Decl(staticPropertyAssignmentInherited1.js, 21, 14)) | ||
| >value2 : Symbol(Derived.value2, Decl(staticPropertyAssignmentInherited1.js, 12, 7)) | ||
|
|
||
| cls.value3; | ||
| >cls.value3 : Symbol(Derived.value3, Decl(staticPropertyAssignmentInherited1.js, 15, 11)) | ||
| >cls : Symbol(cls, Decl(staticPropertyAssignmentInherited1.js, 21, 14)) | ||
| >value3 : Symbol(Derived.value3, Decl(staticPropertyAssignmentInherited1.js, 15, 11)) | ||
| } | ||
|
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this drive-by, or necessary?