diff options
author | Teddy Wing | 2023-05-18 02:11:07 +0200 |
---|---|---|
committer | Teddy Wing | 2023-05-18 02:11:07 +0200 |
commit | a54ba9c28ebbde6419e53d265aed2102e46bac9b (patch) | |
tree | e0e390784409aee268399b637e8a8a3af1e13767 | |
parent | 44ef8673bd55c72f280d34bed6b5eaa795a14c59 (diff) | |
download | gocapturedrefrace-a54ba9c28ebbde6419e53d265aed2102e46bac9b.tar.bz2 |
Add test for shadowing declaration
This doesn't pass yet.
-rw-r--r-- | testdata/shadow.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testdata/shadow.go b/testdata/shadow.go index 3672bc6..023df57 100644 --- a/testdata/shadow.go +++ b/testdata/shadow.go @@ -20,4 +20,14 @@ func shadow() { log.Print(err) } }() + + go func() { + // err is redeclared here and shadows the outer scope. No diagnostic + // should be printed. + var err error + err = errors.New("shadowing declaration err") + if err != nil { + log.Print(err) + } + }() } |