2008-10-08 10:21:57 -06:00
|
|
|
// errchk $G $D/$F.go
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
|
2009-05-12 17:09:47 -06:00
|
|
|
// Check that interface{M()} = *interface{M()} produces a compiler error.
|
|
|
|
|
2008-10-08 10:21:57 -06:00
|
|
|
package main
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Inst interface {
|
2008-10-08 10:21:57 -06:00
|
|
|
Next() *Inst;
|
|
|
|
}
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Regexp struct {
|
2008-12-18 23:37:22 -07:00
|
|
|
code []Inst;
|
2008-10-08 10:21:57 -06:00
|
|
|
start Inst;
|
|
|
|
}
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
type Start struct {
|
2008-10-08 10:21:57 -06:00
|
|
|
foo *Inst;
|
|
|
|
}
|
|
|
|
|
|
|
|
func (start *Start) Next() *Inst { return nil }
|
|
|
|
|
|
|
|
|
2009-01-20 15:40:40 -07:00
|
|
|
func AddInst(Inst) *Inst {
|
2008-10-08 10:21:57 -06:00
|
|
|
print("ok in addinst\n");
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
print("call addinst\n");
|
2009-08-03 12:58:52 -06:00
|
|
|
var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible|is not"
|
2008-10-08 10:21:57 -06:00
|
|
|
print("return from addinst\n");
|
|
|
|
}
|