mirror of
https://github.com/burrowers/garble.git
synced 2026-04-22 23:57:14 +08:00
fix: canonicalize generic field objects for struct hashing
Use `types.Var.Origin()` when mapping and hashing struct fields so selector and declaration sites share the same canonical field identity. This fixes build failures for generic aliases and named types over those aliases. Fixes #924
This commit is contained in:
committed by
Daniel Martí
parent
1b6cc14d93
commit
cb98b4daab
Vendored
+12
@@ -16,6 +16,11 @@ func main() {
|
||||
|
||||
g2 := GenericGraph[*[]byte]{Content: new([]byte)}
|
||||
g2.Edges = make([]GenericGraph[*[]byte], 1)
|
||||
|
||||
var ga genericAlias
|
||||
ga.list = nil
|
||||
var gan genericAliasNamed
|
||||
gan.list = nil
|
||||
}
|
||||
|
||||
func GenericFunc[GenericParamA, B any](x GenericParamA, y B) {}
|
||||
@@ -66,3 +71,10 @@ func (w *AsyncResult[oldT, newT]) AsResult() Result[newT] {
|
||||
}
|
||||
|
||||
func (w *AsyncResult[oldT, newT]) Redirect(struct {ret newT}) {}
|
||||
|
||||
type genericAlias = generic[int]
|
||||
type generic[T any] struct {
|
||||
list *T
|
||||
}
|
||||
|
||||
type genericAliasNamed genericAlias
|
||||
|
||||
Reference in New Issue
Block a user