| 93 | } |
| 94 | |
| 95 | func (h HasError) hasError(t super.Type, b scode.Bytes) bool { |
| 96 | switch typ := super.TypeUnder(t).(type) { |
| 97 | case *super.TypeRecord: |
| 98 | it := scode.NewRecordIter(b, typ.Opts) |
| 99 | return slices.ContainsFunc(typ.Fields, func(f super.Field) bool { |
| 100 | elem, none := it.Next(f.Opt) |
| 101 | return !none && h.hasError(f.Type, elem) |
| 102 | }) |
| 103 | case *super.TypeArray, *super.TypeSet: |
| 104 | inner := super.InnerType(typ) |
| 105 | for it := b.Iter(); !it.Done(); { |
| 106 | if h.hasError(inner, it.Next()) { |
| 107 | return true |
| 108 | } |
| 109 | } |
| 110 | return false |
| 111 | case *super.TypeMap: |
| 112 | for it := b.Iter(); !it.Done(); { |
| 113 | if h.hasError(typ.KeyType, it.Next()) || h.hasError(typ.ValType, it.Next()) { |
| 114 | return true |
| 115 | } |
| 116 | } |
| 117 | return false |
| 118 | case *super.TypeUnion: |
| 119 | return h.hasError(typ.Untag(b)) |
| 120 | case *super.TypeError: |
| 121 | return true |
| 122 | default: |
| 123 | return false |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | type Quiet struct { |
| 128 | sctx *super.Context |