-
Robert Griesemer authored
For type switches using a short variable declaration of the form switch t := x.(type) { case T1: ... go/types doesn't declare the symbolic variable (t in this example) with the switch; thus such variables are not found in types.Info.Defs. Instead they are implicitly declared with each type switch case, and can be found in types.Info.Implicits. Adjust the shadowing code accordingly. Added a test case to verify that the issue is fixed, and a test case verifying that the shadowing code now considers implicitly declared variables introduces in type switch cases. While at it, also fixed the (internal) error reporting to provide more accurate information. Fixe #26725. Change-Id: If408ed9e692bf47c640f81de8f46bf5eb43415b0 Reviewed-on: https://go-review.googlesource.com/135117 Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Alan Donovan <adonovan@google.com>
77e503a3