From 03cee0656c9fd8cf9509c3a91baf72db4a8f6d28 Mon Sep 17 00:00:00 2001 From: 徐志强 <652732310@qq.com> Date: Tue, 18 Feb 2020 16:03:32 +0800 Subject: scope.add should only record the first position --- tools/go_generics/globals/scope.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tools') diff --git a/tools/go_generics/globals/scope.go b/tools/go_generics/globals/scope.go index 96c965ea2..eec93534b 100644 --- a/tools/go_generics/globals/scope.go +++ b/tools/go_generics/globals/scope.go @@ -72,6 +72,10 @@ func (s *scope) deepLookup(n string) *symbol { } func (s *scope) add(name string, kind SymKind, pos token.Pos) { + if s.syms[name] != nil { + return + } + s.syms[name] = &symbol{ kind: kind, pos: pos, -- cgit v1.2.3