Skip to content

Commit 6a945f3

Browse files
committed
Add integer/float variable ambiguity tests
1 parent c978057 commit 6a945f3

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/test/numerics.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,45 @@ fn float_kind_trait() {
7777
}
7878
}
7979
}
80+
81+
/// You can still get ambiguous results with integer variables
82+
#[test]
83+
fn integer_ambiguity() {
84+
test! {
85+
program {
86+
trait Foo {}
87+
88+
impl Foo for usize {}
89+
impl Foo for isize {}
90+
}
91+
92+
goal {
93+
exists<int N> {
94+
N: Foo
95+
}
96+
} yields {
97+
"Ambiguous; no inference guidance"
98+
}
99+
}
100+
}
101+
102+
/// You can still get ambiguous results with float variables
103+
#[test]
104+
fn float_ambiguity() {
105+
test! {
106+
program {
107+
trait Foo {}
108+
109+
impl Foo for f32 {}
110+
impl Foo for f64 {}
111+
}
112+
113+
goal {
114+
exists<float N> {
115+
N: Foo
116+
}
117+
} yields {
118+
"Ambiguous; no inference guidance"
119+
}
120+
}
121+
}

0 commit comments

Comments
 (0)