| 1 |
package foo:bar; |
| 2 |
|
| 3 |
interface foo { |
| 4 |
resource bar { |
| 5 |
constructor(); |
| 6 |
a: static func(); |
| 7 |
b: func(); |
| 8 |
} |
| 9 |
|
| 10 |
a: func(x: bar) -> bar; |
| 11 |
type t = bar; |
| 12 |
type t2 = own<bar>; |
| 13 |
} |
| 14 |
|
| 15 |
interface baz { |
| 16 |
use foo.{bar,t}; |
| 17 |
a: func(x: bar) -> bar; |
| 18 |
|
| 19 |
b: func() -> t; |
| 20 |
} |
| 21 |
|
| 22 |
|
| 23 |
world some-world { |
| 24 |
use baz.{bar}; |
| 25 |
|
| 26 |
resource a { |
| 27 |
constructor(); |
| 28 |
} |
| 29 |
|
| 30 |
resource b { |
| 31 |
constructor() -> result<b, string>; |
| 32 |
} |
| 33 |
|
| 34 |
export x: func() -> a; |
| 35 |
export y: func() -> bar; |
| 36 |
|
| 37 |
import anon: interface { |
| 38 |
resource a { |
| 39 |
constructor(); |
| 40 |
|
| 41 |
b: static func(); |
| 42 |
|
| 43 |
c: func(); |
| 44 |
} |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
interface implicit-own-handles { |
| 49 |
resource a; |
| 50 |
|
| 51 |
b: func(a1: a, a2: a) -> own<a>; |
| 52 |
c: func() -> list<own<a>>; |
| 53 |
} |
| 54 |
|
| 55 |
interface implicit-own-handles2 { |
| 56 |
/// the `own` return and list param should be the same `own` |
| 57 |
resource a { |
| 58 |
constructor(a: list<a>); |
| 59 |
} |
| 60 |
|
| 61 |
/// same as above, even when the `list<b>` implicitly-defined `own` comes |
| 62 |
/// before an explicitly defined `own` |
| 63 |
resource b { |
| 64 |
constructor(a: list<b>, b: own<b>); |
| 65 |
} |
| 66 |
|
| 67 |
/// same as the above, the `own` argument should have the same type as the |
| 68 |
/// return value |
| 69 |
resource c { |
| 70 |
a: static func(a: own<c>) -> c; |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
world implicit-own-handles3 { |
| 75 |
/// there should only be one `list` type despite there looking like two |
| 76 |
/// list types here |
| 77 |
resource a { |
| 78 |
constructor(a: list<a>, b: list<own<a>>); |
| 79 |
} |
| 80 |
} |