Skip to content

Commit 9f0239c

Browse files
committed
add a test where mode inference ought to fail
1 parent dd51031 commit 9f0239c

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// In this test, the mode gets inferred to ++ due to the apply_int(),
2+
// but then we get a failure in the generic apply().
3+
4+
fn apply<A>(f: fn(A) -> A, a: A) -> A { f(a) }
5+
fn apply_int(f: fn(int) -> int, a: int) -> int { f(a) }
6+
7+
fn main() {
8+
let f = {|i| i};
9+
assert apply_int(f, 2) == 2;
10+
assert apply(f, 2) == 2; //! ERROR expected argument mode ++
11+
}

0 commit comments

Comments
 (0)