| 1 | interface IBar { |
| 2 | opt ?string |
| 3 | } |
| 4 | |
| 5 | struct Bar implements IBar { |
| 6 | opt ?string |
| 7 | } |
| 8 | |
| 9 | struct Foo { |
| 10 | field IBar |
| 11 | } |
| 12 | |
| 13 | fn (f &Foo) t() { |
| 14 | if f.field.opt != none { |
| 15 | assert f.field.opt == 'foo' |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | fn test_main() { |
| 20 | a := Foo{ |
| 21 | field: Bar{ |
| 22 | opt: 'foo' |
| 23 | } |
| 24 | } |
| 25 | if a.field.opt != none { |
| 26 | assert a.field.opt == 'foo' |
| 27 | } |
| 28 | a.t() |
| 29 | } |
| 30 |