2021-03-04 06:56:01 -07:00
|
|
|
// errorcheck -d=panic
|
2018-03-29 19:22:23 -06:00
|
|
|
|
|
|
|
// 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{}) {
|
2021-03-04 06:56:01 -07:00
|
|
|
if x, ok := i.(type); ok { // ERROR "assignment mismatch|outside type switch"
|
2020-12-09 13:28:15 -07:00
|
|
|
_ = x
|
2018-03-29 19:22:23 -06:00
|
|
|
}
|
|
|
|
}
|