mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
receive {
switch <HERE>
}
In the current Parser implementation, if there's a error in 'switch'
subject, the 'SwitchStmt' is not placed in the parsed AST.
When the type checker searches AST node at the location, it used to find
'receive { ... }' because that is the *innermost* node in the AST that
contains the loc. But the decl context is the closure. This behavior used
to cause crashes because 'receive { ... }' is re-typechecked.
For solution, when finding the innermost AST node, clear the found node
in parent context before walking into brace statement.
rdar://problem/69246891
22 lines
432 B
Swift
22 lines
432 B
Swift
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE -source-filename=%s
|
|
// RUN: %target-swift-ide-test -code-completion -code-completion-token=COMPLETE_2 -source-filename=%s
|
|
|
|
class MyCls {
|
|
public init(body: (Int) throws -> Void) {}
|
|
}
|
|
|
|
func foo() {
|
|
MyCls { arg in
|
|
MyCls { #^COMPLETE^#
|
|
}
|
|
}
|
|
}
|
|
|
|
func receive(fn: () -> throws Void) {}
|
|
|
|
func test2() {
|
|
receive {
|
|
switch #^COMPLETE_2^#
|
|
}
|
|
}
|