Skip to content

Commit 1ce7add

Browse files
committed
add a test for subtyping in tail call signature check
1 parent 0ef36d2 commit 1ce7add

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Check that signature comparison for tail calls allows subtyping.
2+
//
3+
//@ check-pass
4+
#![expect(incomplete_features)]
5+
#![feature(explicit_tail_calls)]
6+
7+
fn f<'short>(
8+
a: &'static (),
9+
b: &'short (),
10+
c: fn(&'static ()),
11+
d: for<'a> fn(&'a ()),
12+
) -> (&'short (), fn(&'static ()), for<'a> fn(&'a ())) {
13+
become g(b, a, d, c);
14+
}
15+
16+
fn g<'short>(
17+
// swapped short/static
18+
a: &'short (),
19+
b: &'static (),
20+
// swapped binder/non binder
21+
c: for<'a> fn(&'a ()),
22+
d: fn(&'static ()),
23+
// 'short=>'static; non binder=>binder
24+
) -> (&'static (), for<'a> fn(&'a ()), for<'a> fn(&'a ())) {
25+
(b, c, c)
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)