Skip to content

Commit 5b8abec

Browse files
committed
test for pure fn vs impure fn etc subtyping
1 parent 6dc4bc5 commit 5b8abec

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Test rules governing higher-order pure fns.
2+
3+
fn assign_to_pure(x: pure fn(), y: fn(), z: unsafe fn()) {
4+
let a: pure fn() = x;
5+
let b: pure fn() = y; //! ERROR expected pure fn but found impure fn
6+
let c: pure fn() = z; //! ERROR expected pure fn but found unsafe fn
7+
}
8+
9+
fn assign_to_impure(x: pure fn(), y: fn(), z: unsafe fn()) {
10+
let h: fn() = x;
11+
let i: fn() = y;
12+
let j: fn() = z; //! ERROR expected impure fn but found unsafe fn
13+
}
14+
15+
fn assign_to_unsafe(x: pure fn(), y: fn(), z: unsafe fn()) {
16+
let m: unsafe fn() = x;
17+
let n: unsafe fn() = y;
18+
let o: unsafe fn() = z;
19+
}
20+
21+
fn main() {
22+
}

0 commit comments

Comments
 (0)