@@ -188,36 +188,24 @@ extension Parser {
188188 }
189189
190190 mutating func parseQualifiedTypeIdentifier( ) -> RawTypeSyntax {
191- if self . at ( . keyword( . Any) ) {
192- return RawTypeSyntax ( self . parseAnyType ( ) )
193- }
194191
195- let ( unexpectedBeforeName , name ) = self . expect ( anyIn : IdentifierTypeSyntax . NameOptions . self , default : . identifier )
196- let generics : RawGenericArgumentClauseSyntax ?
197- if self . at ( prefix : " < " ) {
198- generics = self . parseGenericArguments ( )
199- } else {
200- generics = nil
192+ let identifierType = self . parseTypeIdentifier ( )
193+ var result = RawTypeSyntax ( identifierType )
194+
195+ // There are no nested types inside `Any`.
196+ if case TokenSpec . keyword ( . Any ) = identifierType . name {
197+ return result
201198 }
202199
203- var result = RawTypeSyntax (
204- RawIdentifierTypeSyntax (
205- moduleSelector: nil ,
206- unexpectedBeforeName,
207- name: name,
208- genericArgumentClause: generics,
209- arena: self . arena
210- )
211- )
200+ func hasAnotherMember( ) -> Bool {
201+ // If qualified name base type cannot be parsed from the current
202+ // point (i.e. the next type identifier is not followed by a '.'),
203+ // then the next identifier is the final declaration name component.
204+ var lookahead = self . lookahead ( )
205+ return lookahead. consume ( ifPrefix: " . " , as: . period) != nil && lookahead. canParseBaseTypeForQualifiedDeclName ( )
206+ }
212207
213- // If qualified name base type cannot be parsed from the current
214- // point (i.e. the next type identifier is not followed by a '.'),
215- // then the next identifier is the final declaration name component.
216- var lookahead = self . lookahead ( )
217- guard
218- lookahead. consume ( ifPrefix: " . " , as: . period) != nil ,
219- lookahead. canParseBaseTypeForQualifiedDeclName ( )
220- else {
208+ guard hasAnotherMember ( ) else {
221209 return result
222210 }
223211
@@ -248,14 +236,7 @@ extension Parser {
248236 )
249237 )
250238
251- // If qualified name base type cannot be parsed from the current
252- // point (i.e. the next type identifier is not followed by a '.'),
253- // then the next identifier is the final declaration name component.
254- var lookahead = self . lookahead ( )
255- guard
256- lookahead. consume ( ifPrefix: " . " , as: . period) != nil ,
257- lookahead. canParseBaseTypeForQualifiedDeclName ( )
258- else {
239+ guard hasAnotherMember ( ) else {
259240 break
260241 }
261242
0 commit comments