(elems []super.Value)
| 93 | } |
| 94 | |
| 95 | func (u *unblend) unify(elems []super.Value) (super.Type, scode.Bytes) { |
| 96 | seen := make(map[super.Type]struct{}) |
| 97 | var types []super.Type |
| 98 | for _, e := range elems { |
| 99 | typ := e.Type() |
| 100 | if _, ok := seen[typ]; !ok { |
| 101 | seen[typ] = struct{}{} |
| 102 | types = append(types, typ) |
| 103 | } |
| 104 | } |
| 105 | if len(types) == 1 { |
| 106 | var b scode.Builder |
| 107 | for _, e := range elems { |
| 108 | b.Append(e.Bytes()) |
| 109 | } |
| 110 | return types[0], b.Bytes() |
| 111 | } |
| 112 | var b scode.Builder |
| 113 | union := u.sctx.LookupTypeUnion(types) |
| 114 | for _, e := range elems { |
| 115 | super.BuildUnion(&b, union.TagOf(e.Type()), e.Bytes()) |
| 116 | } |
| 117 | return union, b.Bytes() |
| 118 | } |
| 119 | |
| 120 | func (u *unblend) unifyType(vals []super.Value) super.Type { |
| 121 | seen := make(map[super.Type]struct{}) |
no test coverage detected