(vals []super.Value, types map[super.Type]struct{})
| 189 | } |
| 190 | |
| 191 | func (c *cast) maybeConvertToUnion(vals []super.Value, types map[super.Type]struct{}) (super.Type, bool) { |
| 192 | typesSlice := slices.Collect(maps.Keys(types)) |
| 193 | if len(typesSlice) == 1 { |
| 194 | return typesSlice[0], true |
| 195 | } |
| 196 | union := c.sctx.LookupTypeUnion(typesSlice) |
| 197 | aok := true |
| 198 | for i, val := range vals { |
| 199 | var ok bool |
| 200 | vals[i], ok = c.toUnion(val, union) |
| 201 | aok = aok && ok |
| 202 | } |
| 203 | return union, aok |
| 204 | } |
| 205 | |
| 206 | func (c *cast) toMap(from super.Value, to *super.TypeMap) (super.Value, bool) { |
| 207 | fromType, ok := from.Type().(*super.TypeMap) |
no test coverage detected