This fixes cherry-pick CL 531998.
For #63339.
Change-Id: I6dac0909ca85d68684ce36025284d25db32e0b15
Reviewed-on: https://go-review.googlesource.com/c/go/+/535135
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
// Before we change the type (type parameter renaming, below), make
// a clone of it as otherwise we implicitly modify the object's type
// (go.dev/issues/63260).
- asig = clone(asig)
+ clone := *asig
+ asig = &clone
// Rename type parameters for cases like f(g, g); this gives each
// generic function argument a unique type identity (go.dev/issues/59956).
// TODO(gri) Consider only doing this if a function argument appears
}
return nil
}
-
-// clone makes a "flat copy" of *p and returns a pointer to the copy.
-func clone[P *T, T any](p P) P {
- c := *p
- return &c
-}
// Before we change the type (type parameter renaming, below), make
// a clone of it as otherwise we implicitly modify the object's type
// (go.dev/issues/63260).
- asig = clone(asig)
+ clone := *asig
+ asig = &clone
// Rename type parameters for cases like f(g, g); this gives each
// generic function argument a unique type identity (go.dev/issues/59956).
// TODO(gri) Consider only doing this if a function argument appears
}
return nil
}
-
-// clone makes a "flat copy" of *p and returns a pointer to the copy.
-func clone[P *T, T any](p P) P {
- c := *p
- return &c
-}