mirror of
https://github.com/golang/go
synced 2024-09-30 12:28:35 -06:00
668e3a598f
Address outstanding TODO, which simplifies subsequent CLs. Now the compiler always type checks type-switch case clauses (like gccgo), but it treats clause variables as broken if an appropriate type cannot be determined for it (like go/types). Passes toolstash-check. Change-Id: Iedfe9cdf38c6865211e4b93391f1cf72c1bed136 Reviewed-on: https://go-review.googlesource.com/c/go/+/272648 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org> Trust: Matthew Dempsky <mdempsky@google.com>
19 lines
383 B
Go
19 lines
383 B
Go
// errorcheck
|
|
|
|
// Copyright 2011 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.
|
|
|
|
// Issue 1606.
|
|
|
|
package main
|
|
|
|
func main() {
|
|
var x interface{}
|
|
switch t := x.(type) {
|
|
case 0: // ERROR "type"
|
|
t.x = 1
|
|
x.x = 1 // ERROR "type interface \{\}|reference to undefined field or method"
|
|
}
|
|
}
|