Skip to content

Commit a2fad18

Browse files
committed
AST: Change mayHaveMembers() to return true for TupleType
1 parent c1b8690 commit a2fad18

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

include/swift/AST/Types.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -900,20 +900,24 @@ class alignas(1 << TypeAlignInBits) TypeBase
900900
bool satisfiesClassConstraint();
901901

902902
/// Determine whether this type can be used as a base type for AST
903-
/// name lookup, which is the case for nominal types, protocol compositions
904-
/// and archetypes.
903+
/// name lookup, which is the case for nominal types, existential types,
904+
/// archetypes, and tuples.
905905
///
906906
/// Generally, the static vs instance and mutating vs nonmutating distinction
907907
/// is handled elsewhere, so metatypes, lvalue types and inout types are not
908908
/// allowed here.
909909
///
910-
/// Similarly, tuples formally have members, but this does not go through
911-
/// name lookup.
910+
/// Tuples have formal members to project elements by index or by label; these
911+
/// are handled directly by Sema and do not go through name lookup.
912+
///
913+
/// Bona fide members on tuples are defined on extensions of
914+
/// Builtin.TheTupleType.
912915
bool mayHaveMembers() {
913916
return (is<ArchetypeType>() ||
914917
is<ModuleType>() ||
915918
isExistentialType() ||
916-
getAnyNominal());
919+
getAnyNominal() ||
920+
is<TupleType>());
917921
}
918922

919923
/// Checks whether this type may potentially be callable. This returns true

0 commit comments

Comments
 (0)