aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/tests.rs')
-rw-r--r--crates/ra_hir/src/ty/tests.rs55
1 files changed, 49 insertions, 6 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs
index 9a26e02fa..ca1693679 100644
--- a/crates/ra_hir/src/ty/tests.rs
+++ b/crates/ra_hir/src/ty/tests.rs
@@ -3983,11 +3983,11 @@ fn test(x: impl Trait<u64>, y: &impl Trait<u64>) {
3983 [180; 183) 'bar': fn bar() -> impl Trait<u64> 3983 [180; 183) 'bar': fn bar() -> impl Trait<u64>
3984 [180; 185) 'bar()': impl Trait<u64> 3984 [180; 185) 'bar()': impl Trait<u64>
3985 [191; 192) 'x': impl Trait<u64> 3985 [191; 192) 'x': impl Trait<u64>
3986 [191; 198) 'x.foo()': {unknown} 3986 [191; 198) 'x.foo()': u64
3987 [204; 205) 'y': &impl Trait<u64> 3987 [204; 205) 'y': &impl Trait<u64>
3988 [204; 211) 'y.foo()': {unknown} 3988 [204; 211) 'y.foo()': u64
3989 [217; 218) 'z': impl Trait<u64> 3989 [217; 218) 'z': impl Trait<u64>
3990 [217; 224) 'z.foo()': {unknown} 3990 [217; 224) 'z.foo()': u64
3991 [230; 231) 'x': impl Trait<u64> 3991 [230; 231) 'x': impl Trait<u64>
3992 [230; 238) 'x.foo2()': i64 3992 [230; 238) 'x.foo2()': i64
3993 [244; 245) 'y': &impl Trait<u64> 3993 [244; 245) 'y': &impl Trait<u64>
@@ -4033,11 +4033,11 @@ fn test(x: dyn Trait<u64>, y: &dyn Trait<u64>) {
4033 [177; 180) 'bar': fn bar() -> dyn Trait<u64> 4033 [177; 180) 'bar': fn bar() -> dyn Trait<u64>
4034 [177; 182) 'bar()': dyn Trait<u64> 4034 [177; 182) 'bar()': dyn Trait<u64>
4035 [188; 189) 'x': dyn Trait<u64> 4035 [188; 189) 'x': dyn Trait<u64>
4036 [188; 195) 'x.foo()': {unknown} 4036 [188; 195) 'x.foo()': u64
4037 [201; 202) 'y': &dyn Trait<u64> 4037 [201; 202) 'y': &dyn Trait<u64>
4038 [201; 208) 'y.foo()': {unknown} 4038 [201; 208) 'y.foo()': u64
4039 [214; 215) 'z': dyn Trait<u64> 4039 [214; 215) 'z': dyn Trait<u64>
4040 [214; 221) 'z.foo()': {unknown} 4040 [214; 221) 'z.foo()': u64
4041 [227; 228) 'x': dyn Trait<u64> 4041 [227; 228) 'x': dyn Trait<u64>
4042 [227; 235) 'x.foo2()': i64 4042 [227; 235) 'x.foo2()': i64
4043 [241; 242) 'y': &dyn Trait<u64> 4043 [241; 242) 'y': &dyn Trait<u64>
@@ -4185,6 +4185,49 @@ fn test<T: Trait<Type = u32>>(x: T, y: impl Trait<Type = i64>) {
4185} 4185}
4186 4186
4187#[test] 4187#[test]
4188fn impl_trait_assoc_binding_projection_bug() {
4189 let (db, pos) = TestDB::with_position(
4190 r#"
4191//- /main.rs crate:main deps:std
4192pub trait Language {
4193 type Kind;
4194}
4195pub enum RustLanguage {}
4196impl Language for RustLanguage {
4197 type Kind = SyntaxKind;
4198}
4199struct SyntaxNode<L> {}
4200fn foo() -> impl Iterator<Item = SyntaxNode<RustLanguage>> {}
4201
4202trait Clone {
4203 fn clone(&self) -> Self;
4204}
4205
4206fn api_walkthrough() {
4207 for node in foo() {
4208 node.clone()<|>;
4209 }
4210}
4211
4212//- /std.rs crate:std
4213#[prelude_import] use iter::*;
4214mod iter {
4215 trait IntoIterator {
4216 type Item;
4217 }
4218 trait Iterator {
4219 type Item;
4220 }
4221 impl<T: Iterator> IntoIterator for T {
4222 type Item = <T as Iterator>::Item;
4223 }
4224}
4225"#,
4226 );
4227 assert_eq!("{unknown}", type_at_pos(&db, pos));
4228}
4229
4230#[test]
4188fn projection_eq_within_chalk() { 4231fn projection_eq_within_chalk() {
4189 // std::env::set_var("CHALK_DEBUG", "1"); 4232 // std::env::set_var("CHALK_DEBUG", "1");
4190 assert_snapshot!( 4233 assert_snapshot!(