mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Missed this in my previous patch, avoid relying on the `in` location for closures with parameters and capture lists. Instead, form scopes that start at the first element of the body. This fixes a crasher uncovered by the fuzzer.
20 lines
597 B
Swift
20 lines
597 B
Swift
// Note: test of the scope map. All of these tests are line- and
|
|
// column-sensitive, so any additions should go at the end.
|
|
|
|
struct X {}
|
|
var y: () -> X
|
|
|
|
struct S {
|
|
let x: () = y = {() -> X in
|
|
return .init()
|
|
}
|
|
}
|
|
|
|
// RUN: %target-swift-frontend -dump-scope-maps expanded %s 2>&1 | %FileCheck %s
|
|
|
|
// rdar://147751795 - Make sure we don't end up with a duplicate closure scope.
|
|
// CHECK: PatternEntryInitializerScope {{.*}}, [8:15 - 10:3] entry 0 'x'
|
|
// CHECK-NEXT: `-ClosureParametersScope {{.*}}, [9:5 - 10:3]
|
|
// CHECK-NEXT: `-BraceStmtScope {{.*}}, [9:5 - 10:3]
|
|
// CHECK-EMPTY:
|