Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 1 | // 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 | |
| 7 | package main |
| 8 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 9 | type Inst interface { |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 10 | Next() *Inst; |
| 11 | } |
| 12 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 13 | type Regexp struct { |
Russ Cox | d47d888 | 2008-12-18 22:37:22 -0800 | [diff] [blame] | 14 | code []Inst; |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 15 | start Inst; |
| 16 | } |
| 17 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 18 | type Start struct { |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 19 | foo *Inst; |
| 20 | } |
| 21 | |
| 22 | func (start *Start) Next() *Inst { return nil } |
| 23 | |
| 24 | |
Russ Cox | 839a684 | 2009-01-20 14:40:40 -0800 | [diff] [blame] | 25 | func AddInst(Inst) *Inst { |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 26 | print("ok in addinst\n"); |
| 27 | return nil |
| 28 | } |
| 29 | |
| 30 | func main() { |
Russ Cox | 5564504 | 2009-01-06 15:19:02 -0800 | [diff] [blame] | 31 | re := new(Regexp); |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 32 | print("call addinst\n"); |
Russ Cox | 5564504 | 2009-01-06 15:19:02 -0800 | [diff] [blame] | 33 | var x Inst = AddInst(new(Start)); // ERROR "illegal|incompatible" |
Russ Cox | b4f8e01 | 2008-10-08 09:21:57 -0700 | [diff] [blame] | 34 | print("return from addinst\n"); |
| 35 | } |