diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-19 19:46:37 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-19 19:46:37 +0000 |
commit | e00b9ca3c94d8f88cc5aede562365025a59af06b (patch) | |
tree | e5c668e033b33a11208bb0e2f3fd8bee51ad0f2b /crates/ra_hir_ty/src/tests/method_resolution.rs | |
parent | 889851b52e05f95bf04c6b577a0a63b8e0e523cb (diff) | |
parent | 5b05209744ce7dcd15f814482babbfd163553b57 (diff) |
Merge #3215
3215: Exclude methods from non-parameter types introduced by generic constraints r=flodiebold a=lnicola
Fixes #3184.
r? @flodiebold
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/tests/method_resolution.rs')
-rw-r--r-- | crates/ra_hir_ty/src/tests/method_resolution.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/tests/method_resolution.rs b/crates/ra_hir_ty/src/tests/method_resolution.rs index 1f767d324..644d59e17 100644 --- a/crates/ra_hir_ty/src/tests/method_resolution.rs +++ b/crates/ra_hir_ty/src/tests/method_resolution.rs | |||
@@ -1008,6 +1008,29 @@ fn test() { foo.call()<|>; } | |||
1008 | } | 1008 | } |
1009 | 1009 | ||
1010 | #[test] | 1010 | #[test] |
1011 | fn method_resolution_non_parameter_type() { | ||
1012 | let t = type_at( | ||
1013 | r#" | ||
1014 | //- /main.rs | ||
1015 | mod a { | ||
1016 | pub trait Foo { | ||
1017 | fn foo(&self); | ||
1018 | } | ||
1019 | } | ||
1020 | |||
1021 | struct Wrapper<T>(T); | ||
1022 | fn foo<T>(t: Wrapper<T>) | ||
1023 | where | ||
1024 | Wrapper<T>: a::Foo, | ||
1025 | { | ||
1026 | t.foo()<|>; | ||
1027 | } | ||
1028 | "#, | ||
1029 | ); | ||
1030 | assert_eq!(t, "{unknown}"); | ||
1031 | } | ||
1032 | |||
1033 | #[test] | ||
1011 | fn method_resolution_slow() { | 1034 | fn method_resolution_slow() { |
1012 | // this can get quite slow if we set the solver size limit too high | 1035 | // this can get quite slow if we set the solver size limit too high |
1013 | let t = type_at( | 1036 | let t = type_at( |