tape: Fix peekSlice not using the correct tag

This commit is contained in:
Sasha Koshka 2025-07-04 12:22:49 -04:00
parent 07fc77c83e
commit c8a2f03ca1

View File

@ -251,7 +251,7 @@ func setInt(destination reflect.Value, value uint64) error {
return nil
}
// setInt expects a settable destination.
// setFloat expects a settable destination.
func setFloat(destination reflect.Value, value float64) error {
if !destination.CanFloat() {
return fmt.Errorf("cannot assign float to %T", destination.Interface())
@ -345,11 +345,14 @@ func typeOf(decoder *Decoder, tag Tag) (reflect.Type, error) {
func peekSlice(decoder *Decoder, tag Tag) (Tag, int, error) {
offset := 0
dimension := 0
currentTag := tag
for {
elem, populated, n, err := peekSliceOnce(decoder, tag, offset)
elem, populated, n, err := peekSliceOnce(decoder, currentTag, offset)
if err != nil { return 0, 0, err }
currentTag = elem
offset = n
dimension += 1
fmt.Println(n)
if elem.Is(OTA) {
if !populated {
// default to a large byte array, will be