fix: resolve parameterized $compareTo types and fix array count type
- VisitNameAndData: return any instead of named struct when mergeCompareTo resolves $compareTo, fixing field type mismatches for switch/container types - ContainerCompareTo: traverse anon/bitfield fields for compareTo resolution, fixes entityMetadata 'field not found' errors - Array.Count: change from string to any to handle numeric count values - ArrayEncoder: fix nil check to correctly write length prefix for arrays - ArrayDecoder: use fmt.Sprint for safe Count conversion
This commit is contained in:
@@ -59,6 +59,13 @@ func ContainerCompareTo(g *Generator, parts []string, inExpr ast.Expr, dataRaw a
|
||||
if field.Name == name {
|
||||
return g.VisitCompareTo(parts, SelectorExprAndStr(inExpr, util2.CamelCase(field.Name)), field.Type)
|
||||
}
|
||||
if field.Anon {
|
||||
anonParts := append([]string{name}, parts...)
|
||||
e, cet, err2 := g.VisitCompareTo(anonParts, SelectorExprAndStr(inExpr, "Anon"), field.Type)
|
||||
if err2 == nil {
|
||||
return e, cet, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
err = errors.New("field not found")
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user