mirror of
https://github.com/golang/go
synced 2024-11-23 19:50:06 -07:00
51d8d351c1
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>
17 lines
434 B
Go
17 lines
434 B
Go
// errorcheck -d=panic
|
|
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Verify that we get "use of .(type) outside type switch"
|
|
// before any other (misleading) errors. Test case from issue.
|
|
|
|
package p
|
|
|
|
func f(i interface{}) {
|
|
if x, ok := i.(type); ok { // ERROR "assignment mismatch|outside type switch"
|
|
_ = x
|
|
}
|
|
}
|