1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:50:22 -07:00

f, ok := i.(Foo) does not compile if i already is equivalent to Foo

R=rsc
DELTA=18  (18 added, 0 deleted, 0 changed)
OCL=23544
CL=23547
This commit is contained in:
Rob Pike 2009-01-26 18:35:18 -08:00
parent 3d4d5ad04c
commit fa615a3b30
2 changed files with 22 additions and 0 deletions

18
test/bugs/bug135.go Normal file
View File

@ -0,0 +1,18 @@
// $G $D/$F.go || echo BUG: should compile
// Copyright 2009 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.
package main
type Foo interface { }
type T struct {}
func (t *T) foo() {}
func main() {
t := new(T);
var i interface {};
f, ok := i.(Foo);
}

View File

@ -181,6 +181,10 @@ BUG: should not compile
=========== bugs/bug132.go
BUG: compilation succeeds incorrectly
=========== bugs/bug135.go
bugs/bug135.go:13: assignment count mismatch: 2 = 1
BUG: should compile
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: overflow converting constant to uint