Unreviewed changes
1 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: test/genmeth1.go
Insertions: 16, Deletions: 14.
@@ -8,40 +8,42 @@
package main
-import "fmt"
+import (
+ "fmt"
+ "strings"
+)
type S[A, B any] struct {
- f A
- g B
+ a A
+ b B
}
func (s S[A, B]) m() string {
- return typeStr(s.f, s.g)
+ return typeStr(s.a, s.b)
}
func (s S[A, B]) n[C, D any]() string {
- var x C
- var y D
- return typeStr(s.f, s.g, x, y)
+ var c C
+ var d D
+ return typeStr(s.a, s.b, c, d)
}
func typeStr(args ...any) string {
s := ""
- for i := 0; i < len(args); i++ {
+ for i, arg := range args {
if i > 0 {
s += "->"
}
- // remove "main." prefix for brevity
- s += fmt.Sprintf("%T", args[i])[5:]
+ s += strings.TrimPrefix(fmt.Sprintf("%T", arg), "main.") // trim for brevity
}
return s
}
func main() {
- type T1 int
- type T2 int
- type T3 int
- type T4 int
+ type T1 int8
+ type T2 int16
+ type T3 int32
+ type T4 int64
// method calls
// static dictionary on type
```
Change information
Commit message:
test: more tests for generic methods
These tests verify that generic method type arguments are ordered
correctly for a variety of expression forms and dictionary kinds.
Change-Id: I067206d1e97d5350d6fcc3983f5a6ef24a782214
Change size: M
Delta: 1 file changed, 144 insertions(+), 0 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Robert Griesemer
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI