diff --git a/runtime/sam/expr/function/defuse.go b/runtime/sam/expr/function/defuse.go index 08080be6f..24f272367 100644 --- a/runtime/sam/expr/function/defuse.go +++ b/runtime/sam/expr/function/defuse.go @@ -49,7 +49,7 @@ func (d *defuse) eval(in super.Value) super.Value { fields = append(fields, super.NewField(f.Name, val.Type())) } b.EndContainerWithNones(typ.Opts, nones) - return super.NewValue(d.sctx.MustLookupTypeRecord(fields), b.Bytes()) + return super.NewValue(d.sctx.MustLookupTypeRecord(fields), b.Bytes().Body()) case *super.TypeArray: elems := d.parseArrayOrSet(typ.Type, in.Bytes()) if len(elems) == 0 { diff --git a/runtime/ztests/expr/function/defuse.yaml b/runtime/ztests/expr/function/defuse.yaml index 2822eee1e..0a393f993 100644 --- a/runtime/ztests/expr/function/defuse.yaml +++ b/runtime/ztests/expr/function/defuse.yaml @@ -34,3 +34,13 @@ input: &input | error(1::=er1)::=er2 output: *input + +--- + +spq: defuse(this) + +input: | + {a:fusion(1::(int64|string),)} + +output: | + {a:1}