Skip to content
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

False negative type mismatch with associated types in arguments #15321

Closed
HKalbasi opened this issue Jul 21, 2023 · 0 comments · Fixed by #15325
Closed

False negative type mismatch with associated types in arguments #15321

HKalbasi opened this issue Jul 21, 2023 · 0 comments · Fixed by #15325
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@HKalbasi
Copy link
Member

trait A {
    fn m(&self) -> i32;
}

fn x<T: B>(k: &<T as B>::Ty) {
    k.m();
}

impl A for u8 {
    fn m(&self) -> i32 {
        8
    }
}

impl A for u32 {
    fn m(&self) -> i32 {
        32
    }
}

trait B {
    type Ty: A;
}

impl B for u16 {
    type Ty = u32;
}

#[test]
fn ttt() {
    x::<u16>(&2u8); // Expected u32 found u8 is missing here.
}
@HKalbasi HKalbasi added C-bug Category: bug A-ty type system / type inference / traits / method resolution labels Jul 21, 2023
@bors bors closed this as completed in a317fa8 Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant