-
Notifications
You must be signed in to change notification settings - Fork 2k
Unified: Track all local name kinds in one pass #22284
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
asgerf
wants to merge
18
commits into
github:main
Choose a base branch
from
asgerf:unified/local-type-names
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
Show all changes
18 commits
Select commit
Hold shift + click to select a range
cea1106
unified: Fix extraction of type parameter bounds and constraints
asgerf e0e3406
unified: Support . in name test annotations
asgerf eef277a
unified: Add more local name binding test cases
asgerf 3b51c4c
unified: add MISSING annotations
asgerf 7d1b1e4
unified: Track more kinds of names as local variables
asgerf 5d851e4
unified: More precise scoping inside classes
asgerf 3e25c6a
unified: Rename Variables.qll -> LocalNameBinding.qll
asgerf 6df74d7
unified: Rename 'variables' test
asgerf 686a07d
unified: Rename 'Variable' API to use LocalName terminology
asgerf a5faaef
unified: Two refactorings
asgerf 179ae25
unified: Also include declaration site access
asgerf 427653e
unified: Replace getDefiningNode() with isDeclarationSite()
asgerf 012b1ae
unified: Minor doc comment update
asgerf a3a54c3
unified: fix typo
asgerf 6e89c7b
unified: Add mappings for type parameters on functions and type aliases
asgerf 5a302d5
unified: Add name binding tests
asgerf 74e46ba
unified: Add mappings for constructor calls with generic arguments
asgerf aaa2c1c
unified: Add test with generic constructor call
asgerf 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
106 changes: 106 additions & 0 deletions
106
unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.output
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,106 @@ | ||
| class Foo {} | ||
| class C<T> {} | ||
| let x = C<Foo>() | ||
|
|
||
| --- | ||
|
|
||
| sourceFile | ||
| endOfFileToken: endOfFile | ||
| statements: | ||
| codeBlockItem | ||
| item: | ||
| classDecl | ||
| attributes: | ||
| name: identifier "Foo" | ||
| memberBlock: | ||
| memberBlock | ||
| leftBrace: { | ||
| rightBrace: } | ||
| members: | ||
| modifiers: | ||
| classKeyword: class | ||
| codeBlockItem | ||
| item: | ||
| classDecl | ||
| attributes: | ||
| name: identifier "C" | ||
| genericParameterClause: | ||
| genericParameterClause | ||
| parameters: | ||
| genericParameter | ||
| attributes: | ||
| name: identifier "T" | ||
| leftAngle: < | ||
| rightAngle: > | ||
| memberBlock: | ||
| memberBlock | ||
| leftBrace: { | ||
| rightBrace: } | ||
| members: | ||
| modifiers: | ||
| classKeyword: class | ||
| codeBlockItem | ||
| item: | ||
| variableDecl | ||
| attributes: | ||
| modifiers: | ||
| bindingSpecifier: let | ||
| bindings: | ||
| patternBinding | ||
| initializer: | ||
| initializerClause | ||
| equal: = | ||
| value: | ||
| functionCallExpr | ||
| leftParen: ( | ||
| rightParen: ) | ||
| arguments: | ||
| additionalTrailingClosures: | ||
| calledExpression: | ||
| genericSpecializationExpr | ||
| expression: | ||
| declReferenceExpr | ||
| baseName: identifier "C" | ||
| genericArgumentClause: | ||
| genericArgumentClause | ||
| arguments: | ||
| genericArgument | ||
| argument: | ||
| identifierType | ||
| name: identifier "Foo" | ||
| leftAngle: < | ||
| rightAngle: > | ||
| pattern: | ||
| identifierPattern | ||
| identifier: identifier "x" | ||
|
|
||
| --- | ||
|
|
||
| top_level | ||
| body: | ||
| block | ||
| stmt: | ||
| class_like_declaration | ||
| modifier: modifier "class" | ||
| name: identifier "Foo" | ||
| class_like_declaration | ||
| modifier: modifier "class" | ||
| name: identifier "C" | ||
| type_parameter: | ||
| type_parameter | ||
| name: identifier "T" | ||
| variable_declaration | ||
| modifier: modifier "let" | ||
| pattern: | ||
| name_pattern | ||
| identifier: identifier "x" | ||
| value: | ||
| call_expr | ||
| callee: | ||
| generic_type_expr | ||
| base: | ||
| named_type_expr | ||
| name: identifier "C" | ||
| type_argument: | ||
| named_type_expr | ||
| name: identifier "Foo" |
3 changes: 3 additions & 0 deletions
3
unified/extractor/tests/corpus/swift/functions/constructor-call-with-type-arguments.swift
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,3 @@ | ||
| class Foo {} | ||
| class C<T> {} | ||
| let x = C<Foo>() |
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
77 changes: 77 additions & 0 deletions
77
unified/extractor/tests/corpus/swift/functions/generic-type-alias.output
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,77 @@ | ||
| typealias Box<T: Equatable, U> = Dictionary<T, U> | ||
|
|
||
| --- | ||
|
|
||
| sourceFile | ||
| endOfFileToken: endOfFile | ||
| statements: | ||
| codeBlockItem | ||
| item: | ||
| typeAliasDecl | ||
| attributes: | ||
| name: identifier "Box" | ||
| genericParameterClause: | ||
| genericParameterClause | ||
| parameters: | ||
| genericParameter | ||
| colon: : | ||
| attributes: | ||
| name: identifier "T" | ||
| trailingComma: , | ||
| inheritedType: | ||
| identifierType | ||
| name: identifier "Equatable" | ||
| genericParameter | ||
| attributes: | ||
| name: identifier "U" | ||
| leftAngle: < | ||
| rightAngle: > | ||
| modifiers: | ||
| initializer: | ||
| typeInitializerClause | ||
| equal: = | ||
| value: | ||
| identifierType | ||
| name: identifier "Dictionary" | ||
| genericArgumentClause: | ||
| genericArgumentClause | ||
| arguments: | ||
| genericArgument | ||
| trailingComma: , | ||
| argument: | ||
| identifierType | ||
| name: identifier "T" | ||
| genericArgument | ||
| argument: | ||
| identifierType | ||
| name: identifier "U" | ||
| leftAngle: < | ||
| rightAngle: > | ||
| typealiasKeyword: typealias | ||
|
|
||
| --- | ||
|
|
||
| top_level | ||
| body: | ||
| block | ||
| stmt: | ||
| type_alias_declaration | ||
| name: identifier "Box" | ||
| type_parameter: | ||
| type_parameter | ||
| name: identifier "T" | ||
| bound: | ||
| named_type_expr | ||
| name: identifier "Equatable" | ||
| type_parameter | ||
| name: identifier "U" | ||
| type: | ||
| generic_type_expr | ||
| base: | ||
| named_type_expr | ||
| name: identifier "Dictionary" | ||
| type_argument: | ||
| named_type_expr | ||
| name: identifier "T" | ||
| named_type_expr | ||
| name: identifier "U" |
1 change: 1 addition & 0 deletions
1
unified/extractor/tests/corpus/swift/functions/generic-type-alias.swift
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 @@ | ||
| typealias Box<T: Equatable, U> = Dictionary<T, U> |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.