Source file test/fixedbugs/issue24470.go

     1  // errorcheck -d=panic
     2  
     3  // Copyright 2018 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  // Verify that we get "use of .(type) outside type switch"
     8  // before any other (misleading) errors. Test case from issue.
     9  
    10  package p
    11  
    12  func f(i interface{}) {
    13  	if x, ok := i.(type); ok { // ERROR "assignment mismatch|outside type switch"
    14  		_ = x
    15  	}
    16  }
    17  

View as plain text