]> Cypherpunks repositories - gostls13.git/commitdiff
f, ok := i.(Foo) does not compile if i already is equivalent to Foo
authorRob Pike <r@golang.org>
Tue, 27 Jan 2009 02:35:18 +0000 (18:35 -0800)
committerRob Pike <r@golang.org>
Tue, 27 Jan 2009 02:35:18 +0000 (18:35 -0800)
R=rsc
DELTA=18  (18 added, 0 deleted, 0 changed)
OCL=23544
CL=23547

test/bugs/bug135.go [new file with mode: 0644]
test/golden.out

diff --git a/test/bugs/bug135.go b/test/bugs/bug135.go
new file mode 100644 (file)
index 0000000..d7115c4
--- /dev/null
@@ -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);
+}
index d70df181d33986d381115b58db73ac36eab78654..241225ab096d5c0c7befb637ff7106eeb2d6f9fc 100644 (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