Files
swift-mirror/test/NameLookup/scope_map_rdar147751795.swift
Hamish Knight 8232345b68 [ASTScopes] Avoid relying on in SourceLoc for closures
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.
2025-10-17 15:21:53 +01:00

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: