()
| 435 | } |
| 436 | |
| 437 | func (v Value) Deunion() Value { |
| 438 | for { |
| 439 | typ := v.Type() |
| 440 | if named, ok := typ.(*TypeNamed); ok { |
| 441 | typ = named.Type |
| 442 | } |
| 443 | union, ok := typ.(*TypeUnion) |
| 444 | if !ok { |
| 445 | return v |
| 446 | } |
| 447 | v = NewValue(union.Untag(v.bytes())) |
| 448 | } |
| 449 | } |
| 450 | |
| 451 | // Under resolves named types and untags unions repeatedly, returning a value |
| 452 | // guaranteed not to have a fusion type, named type or union type. |