mirror of
https://github.com/hanzoai/yaegi.git
synced 2026-10-01 00:49:47 +00:00
When generating a new type, the parameter type was not correctly duplicated in the new AST. This is fixed by making copyNode recursive if needed. The out of order processing of generic types has also been fixed. Fixes #1488
22 lines
348 B
Go
22 lines
348 B
Go
package p6
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/netip"
|
|
)
|
|
|
|
type Slice[T any] struct {
|
|
x []T
|
|
}
|
|
|
|
type IPPrefixSlice struct {
|
|
x Slice[netip.Prefix]
|
|
}
|
|
|
|
func (v Slice[T]) MarshalJSON() ([]byte, error) { return json.Marshal(v.x) }
|
|
|
|
// MarshalJSON implements json.Marshaler.
|
|
func (v IPPrefixSlice) MarshalJSON() ([]byte, error) {
|
|
return v.x.MarshalJSON()
|
|
}
|