Skip to content

Commit 603aeb6

Browse files
committed
Add a UI test for types named the same as primitives
1 parent 6b1a91f commit 603aeb6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//@ check-pass
2+
#![allow(non_camel_case_types)]
3+
#![allow(unused)]
4+
5+
// Ensure that primitives do not interfere with user types of similar names
6+
7+
macro_rules! make_ty_mod {
8+
($modname:ident, $ty:tt) => {
9+
mod $modname {
10+
struct $ty {
11+
a: i32,
12+
}
13+
14+
fn assignment() {
15+
let $ty = ();
16+
}
17+
18+
fn access(a: $ty) -> i32 {
19+
a.a
20+
}
21+
}
22+
};
23+
}
24+
25+
make_ty_mod!(check_f16, f16);
26+
make_ty_mod!(check_f32, f32);
27+
make_ty_mod!(check_f64, f64);
28+
make_ty_mod!(check_f128, f128);
29+
30+
fn main() {}

0 commit comments

Comments
 (0)