@@ -498,7 +498,26 @@ import SwiftSyntax
498498}
499499
500500@_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+ /// ```
502521 @_spi ( Experimental) public var defaultIntroducedNames : [ LookupName ] {
503522 var containsExpressionSyntax = false
504523
@@ -942,8 +961,8 @@ extension SubscriptDeclSyntax: WithGenericParametersScopeSyntax, CanInterleaveRe
942961 ) -> [ LookupResult ] {
943962 let clause : IfConfigClauseSyntax ?
944963
945- if let buildConfiguration = config. buildConfiguration {
946- ( clause, _ ) = activeClause ( in : buildConfiguration )
964+ if let configuredRegions = config. configuredRegions {
965+ clause = configuredRegions . activeClause ( for : self )
947966 } else {
948967 clause =
949968 clauses
@@ -967,8 +986,8 @@ extension SubscriptDeclSyntax: WithGenericParametersScopeSyntax, CanInterleaveRe
967986 func getNamedDecls( for config: LookupConfig ) -> [ NamedDeclSyntax ] {
968987 let clause : IfConfigClauseSyntax ?
969988
970- if let buildConfiguration = config. buildConfiguration {
971- ( clause, _ ) = activeClause ( in : buildConfiguration )
989+ if let configuredRegions = config. configuredRegions {
990+ clause = configuredRegions . activeClause ( for : self )
972991 } else {
973992 clause =
974993 clauses
0 commit comments