(typeSet *orderedSet[*Type], includes TypeFlags, t *Type)
| 26150 | } |
| 26151 | |
| 26152 | func (c *Checker) addTypeToIntersection(typeSet *orderedSet[*Type], includes TypeFlags, t *Type) TypeFlags { |
| 26153 | flags := t.flags |
| 26154 | if flags&TypeFlagsIntersection != 0 { |
| 26155 | return c.addTypesToIntersection(typeSet, includes, t.Types()) |
| 26156 | } |
| 26157 | if c.IsEmptyAnonymousObjectType(t) { |
| 26158 | if includes&TypeFlagsIncludesEmptyObject == 0 { |
| 26159 | includes |= TypeFlagsIncludesEmptyObject |
| 26160 | typeSet.add(t) |
| 26161 | } |
| 26162 | } else { |
| 26163 | if flags&TypeFlagsAnyOrUnknown != 0 { |
| 26164 | if t == c.wildcardType { |
| 26165 | includes |= TypeFlagsIncludesWildcard |
| 26166 | } |
| 26167 | if c.isErrorType(t) { |
| 26168 | includes |= TypeFlagsIncludesError |
| 26169 | } |
| 26170 | } else if c.strictNullChecks || flags&TypeFlagsNullable == 0 { |
| 26171 | if t == c.missingType { |
| 26172 | includes |= TypeFlagsIncludesMissingType |
| 26173 | t = c.undefinedType |
| 26174 | } |
| 26175 | if !typeSet.contains(t) { |
| 26176 | if t.flags&TypeFlagsUnit != 0 && includes&TypeFlagsUnit != 0 { |
| 26177 | // We have seen two distinct unit types which means we should reduce to an |
| 26178 | // empty intersection. Adding TypeFlags.NonPrimitive causes that to happen. |
| 26179 | includes |= TypeFlagsNonPrimitive |
| 26180 | } |
| 26181 | typeSet.add(t) |
| 26182 | } |
| 26183 | } |
| 26184 | includes |= flags & TypeFlagsIncludesMask |
| 26185 | } |
| 26186 | return includes |
| 26187 | } |
| 26188 | |
| 26189 | func (c *Checker) removeRedundantSupertypes(types []*Type, includes TypeFlags) []*Type { |
| 26190 | i := len(types) |
no test coverage detected