Same as CL 294031, but for OTYPESW.
Updates #43311
Change-Id: I996f5938835baff1d830c17ed75652315106bdfd
Reviewed-on: https://go-review.googlesource.com/c/go/+/298712
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
case ir.OTYPESW:
n := n.(*ir.TypeSwitchGuard)
base.Errorf("use of .(type) outside type switch")
- n.SetType(nil)
+ n.SetDiag(true)
return n
case ir.ODCLFUNC:
-// errorcheck
+// errorcheck -d=panic
// Copyright 2018 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
package p
func f(i interface{}) {
- if x, ok := i.(type); ok { // ERROR "outside type switch"
+ if x, ok := i.(type); ok { // ERROR "assignment mismatch|outside type switch"
_ = x
}
}