Check for local IDs belong to same definition
This commit is contained in:
parent
766c5f0861
commit
a0fd58bbbe
@ -1161,8 +1161,9 @@ pub(crate) fn generic_predicates_for_param_query(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
WherePredicateTypeTarget::TypeOrConstParam(local_id) => {
|
||||
if *local_id != param_id.local_id {
|
||||
&WherePredicateTypeTarget::TypeOrConstParam(local_id) => {
|
||||
let target_id = TypeOrConstParamId { parent: def, local_id };
|
||||
if target_id != param_id {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -466,6 +466,23 @@ fn test<T: Iterable>() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn associated_type_shorthand_from_self_issue_12484() {
|
||||
check_types(
|
||||
r#"
|
||||
trait Bar {
|
||||
type A;
|
||||
}
|
||||
trait Foo {
|
||||
type A;
|
||||
fn test(a: Self::A, _: impl Bar) {
|
||||
a;
|
||||
//^ Foo::A<Self>
|
||||
}
|
||||
}"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn infer_associated_type_bound() {
|
||||
check_types(
|
||||
|
@ -918,4 +918,26 @@ fn main() {
|
||||
",
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_12484() {
|
||||
check(
|
||||
r#"
|
||||
//- minicore: sized
|
||||
trait SizeUser {
|
||||
type Size;
|
||||
}
|
||||
trait Closure: SizeUser {}
|
||||
trait Encrypt: SizeUser {
|
||||
fn encrypt(self, _: impl Closure<Size = Self::Size>);
|
||||
}
|
||||
fn test(thing: impl Encrypt) {
|
||||
thing.$0;
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
me encrypt(…) (as Encrypt) fn(self, impl Closure<Size = <Self as SizeUser>::Size>)
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user