diff options
author | Matthias Bertschy <matthias.bertschy@gmail.com> | 2019-07-04 08:33:00 +0200 |
---|---|---|
committer | Matthias Bertschy <matthias.bertschy@gmail.com> | 2019-07-12 08:09:48 +0200 |
commit | 239d7c6fdf344fe7051328056b7578657c7b6950 (patch) | |
tree | eb586f1fa583c86b7834718e2fa35974b9f0df7e /tools/go_generics/generics.go | |
parent | 67f2cefce02816307805699c3462d6fd7ce61b69 (diff) |
go_generics: treat the Sel part of an ast.SelectorExpr
Diffstat (limited to 'tools/go_generics/generics.go')
-rw-r--r-- | tools/go_generics/generics.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/go_generics/generics.go b/tools/go_generics/generics.go index 22c714c13..e3912ef2a 100644 --- a/tools/go_generics/generics.go +++ b/tools/go_generics/generics.go @@ -82,7 +82,11 @@ // Note that the second call to g() kept "b" as an argument because it refers to // the local variable "b". // -// Unfortunately, go_generics does not handle anonymous fields with renamed types. +// Note that go_generics can handle anonymous fields with renamed types if -anon is passed in, +// however it does not perform strict checking on parameter types that share the same name +// as the global type and therefore will rename them as well. +// +// You can see an example in the tools/go_generics/generics_tests/interface test. package main import ( @@ -108,6 +112,7 @@ var ( prefix = flag.String("prefix", "", "`prefix` to add to each global symbol") packageName = flag.String("p", "main", "output package `name`") printAST = flag.Bool("ast", false, "prints the AST") + processAnon = flag.Bool("anon", false, "process anonymous fields") types = make(mapValue) consts = make(mapValue) imports = make(mapValue) @@ -231,7 +236,7 @@ func main() { } } } - }) + }, *processAnon) // Remove the definition of all types that are being remapped. set := make(typeSet) |