-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Bind alias ThisProperty assignment declarations #39908
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
1f57e9f
Bind alias ThisProperty assignment declarations
sandersn 562899c
Merge branch 'master' into bind-aliased-this-property-assignments
sandersn d5b0a92
Merge branch 'master' into bind-aliased-this-property-assignments
sandersn 4048a07
Preliminary checker handling for aliases
sandersn abe4b72
new is error; old one should not have been removed
sandersn c3d07c7
I don't even know what's happening with this test
sandersn 948e8c4
cleanup and testing in the checker
sandersn 4e0e7b0
Merge branch 'master' into bind-aliased-this-property-assignments
sandersn a7d6c59
Merge branch 'master' into bind-aliased-this-property-assignments
sandersn 61b94cf
binder: use lookupSymbolForNameWorker instead of mutable
sandersn 0258b62
Shorter name of lookupSymbolForName
sandersn 69601d3
remove oodate comment
sandersn 4650286
fix switch-case-break lint
sandersn a6d4f35
Refactor and move functions
sandersn 5da9f61
Rename and improve type of getContextualTypeForAssignmentDeclaration
sandersn 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
61 changes: 61 additions & 0 deletions
61
tests/baselines/reference/inferringClassMembersFromAssignments6.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,61 @@ | ||
=== tests/cases/conformance/salsa/inferringClassMembersFromAssignments6.js === | ||
function Foonly() { | ||
>Foonly : Symbol(Foonly, Decl(inferringClassMembersFromAssignments6.js, 0, 0)) | ||
|
||
var self = this | ||
>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 1, 7)) | ||
>this : Symbol(Foonly, Decl(inferringClassMembersFromAssignments6.js, 0, 0)) | ||
|
||
self.x = 1 | ||
>self.x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
>self : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
>x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
|
||
self.m = function() { | ||
>self.m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) | ||
>self : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) | ||
>m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) | ||
|
||
console.log(self.x) | ||
>console.log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
>console : Symbol(console, Decl(lib.dom.d.ts, --, --)) | ||
>log : Symbol(Console.log, Decl(lib.dom.d.ts, --, --)) | ||
>self.x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 1, 7)) | ||
>x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
} | ||
} | ||
Foonly.prototype.mreal = function() { | ||
>Foonly.prototype : Symbol(Foonly.mreal, Decl(inferringClassMembersFromAssignments6.js, 6, 1)) | ||
>Foonly : Symbol(Foonly, Decl(inferringClassMembersFromAssignments6.js, 0, 0)) | ||
>prototype : Symbol(Function.prototype, Decl(lib.es5.d.ts, --, --)) | ||
>mreal : Symbol(Foonly.mreal, Decl(inferringClassMembersFromAssignments6.js, 6, 1)) | ||
|
||
var self = this | ||
>self : Symbol(self, Decl(inferringClassMembersFromAssignments6.js, 8, 7)) | ||
>this : Symbol(Foonly, Decl(inferringClassMembersFromAssignments6.js, 0, 0)) | ||
|
||
self.y = 2 | ||
>self.y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) | ||
>self : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) | ||
>y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) | ||
} | ||
const foo = new Foonly() | ||
>foo : Symbol(foo, Decl(inferringClassMembersFromAssignments6.js, 11, 5)) | ||
>Foonly : Symbol(Foonly, Decl(inferringClassMembersFromAssignments6.js, 0, 0)) | ||
|
||
foo.x | ||
>foo.x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
>foo : Symbol(foo, Decl(inferringClassMembersFromAssignments6.js, 11, 5)) | ||
>x : Symbol(Foonly.x, Decl(inferringClassMembersFromAssignments6.js, 1, 19)) | ||
|
||
foo.y | ||
>foo.y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) | ||
>foo : Symbol(foo, Decl(inferringClassMembersFromAssignments6.js, 11, 5)) | ||
>y : Symbol(Foonly.y, Decl(inferringClassMembersFromAssignments6.js, 8, 19)) | ||
|
||
foo.m() | ||
>foo.m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) | ||
>foo : Symbol(foo, Decl(inferringClassMembersFromAssignments6.js, 11, 5)) | ||
>m : Symbol(Foonly.m, Decl(inferringClassMembersFromAssignments6.js, 2, 14)) | ||
|
73 changes: 73 additions & 0 deletions
73
tests/baselines/reference/inferringClassMembersFromAssignments6.types
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,73 @@ | ||
=== tests/cases/conformance/salsa/inferringClassMembersFromAssignments6.js === | ||
function Foonly() { | ||
>Foonly : typeof Foonly | ||
|
||
var self = this | ||
>self : this | ||
>this : this | ||
|
||
self.x = 1 | ||
>self.x = 1 : 1 | ||
>self.x : any | ||
>self : this | ||
>x : any | ||
>1 : 1 | ||
|
||
self.m = function() { | ||
>self.m = function() { console.log(self.x) } : () => void | ||
>self.m : any | ||
>self : this | ||
>m : any | ||
>function() { console.log(self.x) } : () => void | ||
|
||
console.log(self.x) | ||
>console.log(self.x) : void | ||
>console.log : (...data: any[]) => void | ||
>console : Console | ||
>log : (...data: any[]) => void | ||
>self.x : number | ||
>self : this | ||
>x : number | ||
} | ||
} | ||
Foonly.prototype.mreal = function() { | ||
>Foonly.prototype.mreal = function() { var self = this self.y = 2} : () => void | ||
>Foonly.prototype.mreal : any | ||
>Foonly.prototype : any | ||
>Foonly : typeof Foonly | ||
>prototype : any | ||
>mreal : any | ||
>function() { var self = this self.y = 2} : () => void | ||
|
||
var self = this | ||
>self : this | ||
>this : this | ||
|
||
self.y = 2 | ||
>self.y = 2 : 2 | ||
>self.y : number | undefined | ||
>self : this | ||
>y : number | undefined | ||
>2 : 2 | ||
} | ||
const foo = new Foonly() | ||
>foo : Foonly | ||
>new Foonly() : Foonly | ||
>Foonly : typeof Foonly | ||
|
||
foo.x | ||
>foo.x : number | ||
>foo : Foonly | ||
>x : number | ||
|
||
foo.y | ||
>foo.y : number | undefined | ||
>foo : Foonly | ||
>y : number | undefined | ||
|
||
foo.m() | ||
>foo.m() : void | ||
>foo.m : () => void | ||
>foo : Foonly | ||
>m : () => void | ||
|
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.
This string of words doesn’t grok for me, maybe because “get” and ”is” are usually mutually exclusive (though I see this is inherited from the caller), and
ContextSensitive
parses as “context-sensitive” (an adjective), but the “of” makes me think “context” is the noun subject and “sensitive” is the adjective we’re asking about?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.
This led to an in-person discussion in which we noticed that the parent
getIsContextSensitive...
function is a bad member of thegetContextualTypeFor...
family. I just pushed a commit that makes the whole thing returnType | undefined
like the rest.