blob: 649a955f6d7bb03a31f79f2c311477ce1f681909 [file] [log] [blame]
Russ Coxb4f8e012008-10-08 09:21:57 -07001// errchk $G $D/$F.go
2
3// Copyright 2009 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
7package main
8
Russ Cox839a6842009-01-20 14:40:40 -08009type Inst interface {
Russ Coxb4f8e012008-10-08 09:21:57 -070010 Next() *Inst;
11}
12
Russ Cox839a6842009-01-20 14:40:40 -080013type Regexp struct {
Russ Coxd47d8882008-12-18 22:37:22 -080014 code []Inst;
Russ Coxb4f8e012008-10-08 09:21:57 -070015 start Inst;
16}
17
Russ Cox839a6842009-01-20 14:40:40 -080018type Start struct {
Russ Coxb4f8e012008-10-08 09:21:57 -070019 foo *Inst;
20}
21
22func (start *Start) Next() *Inst { return nil }
23
24
Russ Cox839a6842009-01-20 14:40:40 -080025func AddInst(Inst) *Inst {
Russ Coxb4f8e012008-10-08 09:21:57 -070026 print("ok in addinst\n");
27 return nil
28}
29
30func main() {
Russ Cox55645042009-01-06 15:19:02 -080031 re := new(Regexp);
Russ Coxb4f8e012008-10-08 09:21:57 -070032 print("call addinst\n");
Russ Cox55645042009-01-06 15:19:02 -080033 var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible"
Russ Coxb4f8e012008-10-08 09:21:57 -070034 print("return from addinst\n");
35}