Basically, we need to allow variables in the caller self type to unify with the
impl's declared self type. That requires some more contortions in the variable
handling. I'm looking forward to (hopefully) handling this in a cleaner way when
we switch to Chalk's types and unification code.
This commit is contained in:
Florian Diebold 2020-03-01 14:31:35 +01:00
parent 6db2da4993
commit 336a3c6121
4 changed files with 45 additions and 6 deletions

View file

@ -1048,6 +1048,25 @@ where
assert_eq!(t, "{unknown}");
}
#[test]
fn method_resolution_3373() {
let t = type_at(
r#"
//- /main.rs
struct A<T>(T);
impl A<i32> {
fn from(v: i32) -> A<i32> { A(v) }
}
fn main() {
A::from(3)<|>;
}
"#,
);
assert_eq!(t, "A<i32>");
}
#[test]
fn method_resolution_slow() {
// this can get quite slow if we set the solver size limit too high