@@ -47,7 +47,7 @@ func (d *downcast) downcast(typ super.Type, bytes scode.Bytes, to super.Type) (s
4747 return d .downcast (fusionType .Type , superBytes , subtype )
4848 }
4949 }
50- // typ, bytes = deunion(typ, bytes)
50+ typ , bytes = deunion (typ , bytes )
5151 switch to := to .(type ) {
5252 case * super.TypeRecord :
5353 return d .toRecord (typ , bytes , to )
@@ -251,12 +251,16 @@ func (d *downcast) toNamed(typ super.Type, bytes scode.Bytes, to *super.TypeName
251251 // from the union options present. XXX devise a torture test that
252252 // reconstruct nested unions from the flattened named union...?
253253 for _ , t := range unionType .Types {
254+ //fmt.Println("TO NAMED FROM UNION TRY", sup.String(t))
254255 if named , ok := t .(* super.TypeNamed ); ok && named .Name == to .Name {
255- val , errVal := d .downcast (typ , bytes , to .Type )
256- if errVal != nil {
257- return super.Value {}, errVal
258- }
259- return super .NewValue (to , val .Bytes ()), nil
256+ //fmt.Println("TO NAMED FROM UNION MATCH", sup.String(t))
257+ typ , bytes = deunion (typ , bytes )
258+ return super .NewValue (to , bytes ), nil
259+ // val, errVal := d.downcast(typ, bytes, to.Type)
260+ // if errVal != nil {
261+ // return super.Value{}, errVal
262+ // }
263+ // return super.NewValue(to, val.Bytes()), nil
260264 }
261265
262266 }
0 commit comments