Files
swift-mirror/test/NameLookup/scope_map_rdar147751795.swift
Hamish Knight 738c70e8c8 [AST] Always walk folded SequenceExpr if available
Expand the special-cased ASTWalker behavior for folded SequenceExprs
such that we always walk the folded expression when available. This
ensures that we don't attempt to add the same node multiple times
when expanding ASTScopes during pre-checking.

rdar://147751795
2025-03-24 20:18:34 +00:00

20 lines
599 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 {{.*}}, [8:28 - 10:3]
// CHECK-NEXT: `-BraceStmtScope {{.*}}, [8:28 - 10:3]
// CHECK-EMPTY: