diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-07-17 15:32:59 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-07-17 15:32:59 -0700 |
commit | 8e2ea9c1e0fe9b1b4a346ce0a6ceb94fb822f241 (patch) | |
tree | cef8a02142285b34a8883af147b912a596acccc3 /tools/go_generics/generics.go | |
parent | 8e3e021aca89427381af75a47f19b1fe78bf132e (diff) | |
parent | 239d7c6fdf344fe7051328056b7578657c7b6950 (diff) |
Merge pull request #504 from matthyx:master
PiperOrigin-RevId: 258654826
Diffstat (limited to 'tools/go_generics/generics.go')
-rw-r--r-- | tools/go_generics/generics.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/go_generics/generics.go b/tools/go_generics/generics.go index 22c714c13..e9cc2c753 100644 --- a/tools/go_generics/generics.go +++ b/tools/go_generics/generics.go @@ -82,7 +82,12 @@ // 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 +113,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 +237,7 @@ func main() { } } } - }) + }, *processAnon) // Remove the definition of all types that are being remapped. set := make(typeSet) |