mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Handle PatternBindingDecls with missing var locations, which can happen for loop iterator vars, and FuncDecls with missing name and func locations, which can happen for `defer`. Also while here make sure we set the source location of a parser-produced ErrorExpr.
17 lines
675 B
Swift
17 lines
675 B
Swift
// RUN: %target-swift-frontend -typecheck -parse-as-library -verify %s
|
|
// RUN: %target-swift-frontend -dump-ast -parse-as-library %s | %FileCheck %s --check-prefix=CHECK-AST
|
|
|
|
@main
|
|
struct MyBase {
|
|
static func main() throws {
|
|
}
|
|
}
|
|
|
|
// CHECK-AST: (func_decl {{.*}} implicit range=[{{.*}}:[[@LINE-6]]:1 - line:[[@LINE-6]]:1] "$main()" interface_type="(MyBase.Type) -> () throws -> ()" access=internal static
|
|
// CHECK-AST-NEXT: (parameter "self" {{.*}})
|
|
// CHECK-AST-NEXT: (parameter_list)
|
|
// CHECK-AST-NEXT: (brace_stmt implicit
|
|
// CHECK-AST-NEXT: (return_stmt implicit
|
|
// CHECK-AST-NEXT: (try_expr implicit
|
|
// CHECK-AST-NEXT: (call_expr implicit type="()"
|