-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect inference of match
expression result
#3046
Comments
The following works: enum E {
A,
B,
}
fn foo(e: E) -> E {
let x = match e {
E::A => 1,
_ => {
return E::B;
}
};
E::A
} Does "go to definition" work for |
Update: if I move corresponding |
Nope, it wasn't working before the import change. As you may see, on the first screenshot |
Yeah, |
Still, you could argue that the inference should work better. I think the issue is that It's probably a bug in #1945, but I don't really understand the code 🐱. |
Agree. It's very strange that type is inferred that way given that analyzer clearly does not have enough information. |
let x = match 0 {
_ => y,
};
|
Maybe you can update the first post with my example above, since it's simpler? |
#3114 fixes the reduced case where there are no match arms that diverge, but if there's a diverging match arm (like in the original case), we'll still fall back to |
@flodiebold, as for the |
Type inference works fine now for: enum E {
A,
B,
}
fn foo(e: E) -> E {
let x = match e {
E::A => 1,
_ => {
return E::B;
}
};
E::A
} I think this can be closed. |
The following snippet from wasmtime repo is mistakenly inferred as
!
instead ofFrameUnwindKind
:Update: aside of local discussion about known issue with local imports, this issue boils down to
…where
x
is inferred as!
when it probably should be{unknown}
.The text was updated successfully, but these errors were encountered: