MCPcopy Create free account
hub / github.com/brimdata/super / unifyType

Method unifyType

runtime/sam/expr/function/defuse.go:140–158  ·  view source on GitHub ↗
(vals []super.Value)

Source from the content-addressed store, hash-verified

138}
139
140func (d *defuse) unifyType(vals []super.Value) super.Type {
141 seen := make(map[super.Type]struct{})
142 var types []super.Type
143 for _, e := range vals {
144 typ := e.Type()
145 if _, ok := seen[typ]; !ok {
146 seen[typ] = struct{}{}
147 types = append(types, typ)
148 }
149 }
150 switch len(types) {
151 case 0:
152 return super.TypeNull // XXX should be TypeNone
153 case 1:
154 return types[0]
155 default:
156 return d.sctx.LookupTypeUnion(types)
157 }
158}
159
160func (d *defuse) hasFusion(typ super.Type) bool {
161 if fused, ok := d.has[typ]; ok {

Callers 1

evalMethod · 0.95

Calls 2

LookupTypeUnionMethod · 0.80
TypeMethod · 0.65

Tested by

no test coverage detected