fix: resolve all inference vars in InferenceResult::assoc_resolutions

This commit is contained in:
Ryo Yoshida 2022-12-14 21:56:55 +09:00
parent 4596847a88
commit bb99d2a6fb
No known key found for this signature in database
GPG key ID: E25698A930586171
2 changed files with 34 additions and 0 deletions

View file

@ -4079,6 +4079,37 @@ const FOO$0: f64 = 1.0f64;
);
}
#[test]
fn hover_const_eval_in_generic_trait() {
// Doesn't compile, but we shouldn't crash.
check(
r#"
trait Trait<T> {
const FOO: bool = false;
}
struct S<T>(T);
impl<T> Trait<T> for S<T> {
const FOO: bool = true;
}
fn test() {
S::FOO$0;
}
"#,
expect![[r#"
*FOO*
```rust
test
```
```rust
const FOO: bool = true
```
"#]],
);
}
#[test]
fn hover_const_pat() {
check(