-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[TypeChecker] Incremental multi-statement closure type-checking (disabled by default) #38577
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
xedin
merged 76 commits into
swiftlang:main
from
xedin:multi-statement-closure-type-checking
Oct 9, 2021
Merged
Changes from all commits
Commits
Show all changes
76 commits
Select commit
Hold shift + click to select a range
a1c0823
[AST] Add a flag to guard exprimental multi-statement closures feature
xedin eb8eabf
[ConstraintSystem] Add a skeleton of `ClosureBodyElement` constraint
xedin 2b46910
[ConstraintSystem] Add a skeleton of `Conjunction` constraint
xedin 2377f05
[ConstraintSystem] Add a conjunction element producer
xedin 27275f6
[CSStep] Add an implementation of `ConjunctionStep`
xedin 6aaee59
[ConstraintSystem] Allow conjunction constraints to reference other v…
xedin 73dffb3
[ConstraintSystem] Don't require a type variable per closure body ele…
xedin ad01027
[ConstraintSystem] Allow `closure body element` constraint to referen…
xedin f344007
[CSSimplify] Implement conjunction element simplification
xedin 0324a4c
[ConstraintSystem] Implement new required methods in `ConjunctionElem…
xedin 9073d00
[ConstraintSystem] Allow conjunctions marking conjunctions as isolate…
xedin 95119f1
[CSSolver] Don't select disabled conjunctions
xedin 698ea82
[Constraint] Implement `gatherReferencedVariables` for closure body e…
xedin 15aa8ed
[ASTNode] Add a new element - statement condition
xedin 84ca85d
[ConstraintLocator] Add a new element to track closure body elements
xedin 7d48814
[TypeChecker] Integrate experimental multi-statement closures flag in…
xedin 441f807
[ConstraintSystem] Expose type variables referenced by conjunction el…
xedin 28d1bac
[ConstraintSystem] Implement conjunction step
xedin 91eecdb
[CSClosure] Initial support for multi-statement closures
xedin 2b7602e
[CSClosure] Implement constraint generation for closure body elements
xedin 1fa7e1d
[CSStep] Fail conjunction if element attempt fails
xedin d3967f2
[AST] Allow to acquire a pointer to statement condition
xedin a2d4ae3
[ConstraintSystem/Closures] Add support for `if` statement
xedin d814905
[CSClosure] NFC: Simplify creation of non-isolated conjunctions for a…
xedin a37b546
[CSClosure] Mark empty brace statements as non-viable elements
xedin f05ec83
[CSStep] Filter solutions after each conjunction step
xedin 405034f
[CSStep] Always restore snapshot once isolated conjunction step is done
xedin 528c696
[Constraint] Don't propagate variables from elements to conjunction
xedin cedb345
[CSClosure] Further simplify conjunction creation for ASTNode elements
xedin 98a6a84
[CSStep] Conjunction: integrate isolation scope into snapshot
xedin 391b0c6
[ConstraintSystem/Closures] Add support for `guard` statement
xedin f999fa2
[ConstraintSystem/Closures] Add support for `while` statement
xedin 34538ef
[ConstraintSystem/Closures] Add support for `do` statement
xedin d74cb79
[ConstraintSystem/Closures] Add support for `repeat .. while` statement
xedin 55bae61
[Constraint] Allow closure body elements to carry contextual information
xedin 9d89ae0
[ConstraintSystem] Let closure body element simplification take advan…
xedin 00e98ff
[ConstraintSystem/Closures] Add support for `fallthrough` statement
xedin 880d862
[ConstraintSystem/Closures] Add support for `defer` statement
xedin f6398d6
[ConstraintSystem/Closures] Add support for `break` statement
xedin 32b257b
[ConstraintSystem/Closures] Add support for `continue` statement
xedin 305437c
[ConstraintSystem/Closures] Add support for `#assert` statement
xedin 8929d7e
[ConstraintSystem/Closures] Add support for `throw` statement
xedin 7197fac
[ConstraintSystem] Add a new contextual purpose - CTP_ForEachSequence
xedin b1d6d3a
[ConstraintSystem/Closures] Add support for `for-in` statement
xedin df00e3e
[ASTNode] Add a new element - case item
xedin 99a9828
[ConstraintSystem] Add a new contextual purpose - CTP_CaseStmt
xedin c712d07
[PreCheck] Don't attempt to pre-check patterns
xedin 0247652
[ConstraintSystem/Closures] Add support for `case` statement
xedin 1324d1f
[ConstraintSystem/Closures] Add support for `switch` statement
xedin dea609f
[ConstraintSystem/Closures] Add support for `do-catch` statement
xedin c68a74a
[ConstraintSystem/Closures] Allow `return` without result expression
xedin 0104080
[PreCheck] Don't walk into any declaration besides `PatternBindingDecl`
xedin ff4aca3
[ConstraintSystem/Closures] Ignore all unsupported declarations durin…
xedin c554fca
[CSStep] Isolated conjunctions can't see outer solutions
xedin e3aa377
[ConstraintSystem] Allow default initialized patterns
xedin fba8088
[CSClosure] Mark conjunctions representing closure body as isolated
xedin 73f9392
[AST] Allow pattern bindings to be marked as fully verified
xedin d5e9a39
[CSApply] Mark pattern target as fully verified
xedin 598b850
[CSClosure] Allow all declarations to use `typeCheckDecl`
xedin 10fa811
[CSStep] Conjunctions representing closures affect declaration context
xedin 8867a8d
[CSApply] Delay solution application to multi-statement closure bodies
xedin fed705d
[CSClosure] Account for partially resolved inner parameter types
xedin da3cef2
[ResultBuilders] Fix a crash in `PreCheckResultBuilderApplication`
xedin 67a7214
[ConstraintSystem] Compute variables referenced by conjunction elemen…
xedin dfe6c34
[CSClosure] Avoid creating conjunctions for empty bodies
xedin bc14f00
[CSClosure] Link closure conjunction with referenced outer parameters
xedin 9087613
[CSApply] Set types for for all delayed closures
xedin 1dd76d8
[CSClosure] Avoid function conversion when closure result type is opt…
xedin 29ec113
[CSClosures] Model `return` statements as solution application targets
xedin 50af68d
[CSClosure] Handle pattern and sequence of for-in loop together
xedin b7b492f
[CSClosure] Check parameters after solution is applied to the body of…
xedin e5db01b
[CSClosure] Make sure that `case` body variables get types
xedin b8cfaf7
[CSClosure] Make sure that partially resolved params/result gets thei…
xedin 18b23aa
[CSClosure] NFC: Add size to a `SmallVector` in `ClosureConstraintGen…
xedin 87f41a9
[CSClosure] Check multi-statement closure attrs only in if inference …
xedin f074305
[PreCheck] Allow pre-check to walk into patterns when multi-statement…
xedin 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
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
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 feels similar to what one-way constraints effectively do. Can you elaborate on what the difference here is?
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.
One-way constraints form a separate component for left-hand side type variable, in contrast isolated closures have to remove all of the inactive constraints and unrelated type variables and preserve only type variables related to parameter and result, they can't be separated into a component like one-way are because all of the constraints around a closure would have to be brought back after the body is type-checked.