Skip to content

Commit

Permalink
add a comment explaining why two passes are needed
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent committed Apr 24, 2024
1 parent 552f09f commit 8f666bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion runtime/sema/type.go
Original file line number Diff line number Diff line change
Expand Up @@ -4956,13 +4956,16 @@ func (t *CompositeType) MemberMap() *StringMemberOrderedMap {
return t.Members
}

// TODO: improve naming
func newCompositeOrInterfaceSupportedEntitlementSet(
members *StringMemberOrderedMap,
effectiveInterfaceConformanceSet *InterfaceSet,
) *EntitlementSet {
set := &EntitlementSet{}

// We need to handle conjunctions and disjunctions separately, in two passes,
// as adding entitlements after disjunctions does not remove disjunctions from the set,
// whereas adding disjunctions after entitlements does.

// First pass: Handle maps and conjunctions
members.Foreach(func(_ string, member *Member) {
switch access := member.Access.(type) {
Expand Down

0 comments on commit 8f666bb

Please sign in to comment.