@@ -498,7 +498,26 @@ import SwiftSyntax
498
498
}
499
499
500
500
@_spi ( Experimental) extension CatchClauseSyntax : ScopeSyntax {
501
- /// Implicit `error` when there are no catch items.
501
+ /// Name introduced by the catch clause.
502
+ ///
503
+ /// `defaultIntroducedNames` contains implicit `error` name if
504
+ /// no names are declared in catch items and they don't contain any expression patterns.
505
+ /// Otherwise, `defaultIntroducedNames` contains names introduced by the clause.
506
+ ///
507
+ /// ### Example
508
+ /// ```swift
509
+ /// do {
510
+ /// // ...
511
+ /// } catch SomeError, .x(let a) {
512
+ /// // <-- lookup here, result: [a]
513
+ /// } catch .x(let a) {
514
+ /// // <-- lookup here, result: [a]
515
+ /// } catch SomeError {
516
+ /// // <-- lookup here, result: [empty]
517
+ /// } catch {
518
+ /// // <-- lookup here, result: implicit(error)
519
+ /// }
520
+ /// ```
502
521
@_spi ( Experimental) public var defaultIntroducedNames : [ LookupName ] {
503
522
var containsExpressionSyntax = false
504
523
@@ -942,8 +961,8 @@ extension SubscriptDeclSyntax: WithGenericParametersScopeSyntax, CanInterleaveRe
942
961
) -> [ LookupResult ] {
943
962
let clause : IfConfigClauseSyntax ?
944
963
945
- if let buildConfiguration = config. buildConfiguration {
946
- ( clause, _ ) = activeClause ( in : buildConfiguration )
964
+ if let configuredRegions = config. configuredRegions {
965
+ clause = configuredRegions . activeClause ( for : self )
947
966
} else {
948
967
clause =
949
968
clauses
@@ -967,8 +986,8 @@ extension SubscriptDeclSyntax: WithGenericParametersScopeSyntax, CanInterleaveRe
967
986
func getNamedDecls( for config: LookupConfig ) -> [ NamedDeclSyntax ] {
968
987
let clause : IfConfigClauseSyntax ?
969
988
970
- if let buildConfiguration = config. buildConfiguration {
971
- ( clause, _ ) = activeClause ( in : buildConfiguration )
989
+ if let configuredRegions = config. configuredRegions {
990
+ clause = configuredRegions . activeClause ( for : self )
972
991
} else {
973
992
clause =
974
993
clauses
0 commit comments