diff options
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r-- | crates/ra_hir/src/ty/tests.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/crates/ra_hir/src/ty/tests.rs b/crates/ra_hir/src/ty/tests.rs index 41cea9564..c5818b738 100644 --- a/crates/ra_hir/src/ty/tests.rs +++ b/crates/ra_hir/src/ty/tests.rs | |||
@@ -3415,6 +3415,39 @@ fn test(x: Trait, y: &Trait) -> u64 { | |||
3415 | ); | 3415 | ); |
3416 | } | 3416 | } |
3417 | 3417 | ||
3418 | #[test] | ||
3419 | fn weird_bounds() { | ||
3420 | assert_snapshot_matches!( | ||
3421 | infer(r#" | ||
3422 | trait Trait {} | ||
3423 | fn test() { | ||
3424 | let a: impl Trait + 'lifetime = foo; | ||
3425 | let b: impl 'lifetime = foo; | ||
3426 | let b: impl (Trait) = foo; | ||
3427 | let b: impl ('lifetime) = foo; | ||
3428 | let d: impl ?Sized = foo; | ||
3429 | let e: impl Trait + ?Sized = foo; | ||
3430 | } | ||
3431 | "#), | ||
3432 | @r###" | ||
3433 | ⋮ | ||
3434 | ⋮[26; 237) '{ ...foo; }': () | ||
3435 | ⋮[36; 37) 'a': impl Trait + {error} | ||
3436 | ⋮[64; 67) 'foo': impl Trait + {error} | ||
3437 | ⋮[77; 78) 'b': impl {error} | ||
3438 | ⋮[97; 100) 'foo': impl {error} | ||
3439 | ⋮[110; 111) 'b': impl Trait | ||
3440 | ⋮[128; 131) 'foo': impl Trait | ||
3441 | ⋮[141; 142) 'b': impl {error} | ||
3442 | ⋮[163; 166) 'foo': impl {error} | ||
3443 | ⋮[176; 177) 'd': impl {error} | ||
3444 | ⋮[193; 196) 'foo': impl {error} | ||
3445 | ⋮[206; 207) 'e': impl Trait + {error} | ||
3446 | ⋮[231; 234) 'foo': impl Trait + {error} | ||
3447 | "### | ||
3448 | ); | ||
3449 | } | ||
3450 | |||
3418 | fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { | 3451 | fn type_at_pos(db: &MockDatabase, pos: FilePosition) -> String { |
3419 | let file = db.parse(pos.file_id).ok().unwrap(); | 3452 | let file = db.parse(pos.file_id).ok().unwrap(); |
3420 | let expr = algo::find_node_at_offset::<ast::Expr>(file.syntax(), pos.offset).unwrap(); | 3453 | let expr = algo::find_node_at_offset::<ast::Expr>(file.syntax(), pos.offset).unwrap(); |