(types []*Type)
| 1521 | } |
| 1522 | |
| 1523 | func (c *Checker) getSingleCommonSupertype(types []*Type) *Type { |
| 1524 | // First, find the leftmost type for which no type to the right is a strict supertype, and if that |
| 1525 | // type is a strict supertype of all other candidates, return it. Otherwise, return the leftmost type |
| 1526 | // for which no type to the right is a (regular) supertype. |
| 1527 | candidate := c.findLeftmostType(types, (*Checker).isTypeStrictSubtypeOf) |
| 1528 | if core.Every(types, func(t *Type) bool { return t == candidate || c.isTypeStrictSubtypeOf(t, candidate) }) { |
| 1529 | return candidate |
| 1530 | } |
| 1531 | return c.findLeftmostType(types, (*Checker).isTypeSubtypeOf) |
| 1532 | } |
| 1533 | |
| 1534 | func (c *Checker) findLeftmostType(types []*Type, f func(c *Checker, s *Type, t *Type) bool) *Type { |
| 1535 | var candidate *Type |
no test coverage detected