diff options
author | Jonas Schievink <[email protected]> | 2021-02-10 14:54:21 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-02-10 14:59:20 +0000 |
commit | 3c5734712a074a5bb3100dbec8b690e60b5beac0 (patch) | |
tree | 2a9098516877f68242a6d8c7c8fb8bbfd615e19e /crates/hir_ty/src/tests/traits.rs | |
parent | a00fa0c06f70a377279ae77a01f19b05b3cb7437 (diff) |
Add more tests
Diffstat (limited to 'crates/hir_ty/src/tests/traits.rs')
-rw-r--r-- | crates/hir_ty/src/tests/traits.rs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/traits.rs b/crates/hir_ty/src/tests/traits.rs index e5a3f95a6..e030f4a97 100644 --- a/crates/hir_ty/src/tests/traits.rs +++ b/crates/hir_ty/src/tests/traits.rs | |||
@@ -3151,3 +3151,54 @@ fn test() { | |||
3151 | "#, | 3151 | "#, |
3152 | ); | 3152 | ); |
3153 | } | 3153 | } |
3154 | |||
3155 | #[test] | ||
3156 | fn inner_use() { | ||
3157 | check_types( | ||
3158 | r#" | ||
3159 | mod m { | ||
3160 | pub trait Tr { | ||
3161 | fn method(&self) -> u8 { 0 } | ||
3162 | } | ||
3163 | |||
3164 | impl Tr for () {} | ||
3165 | } | ||
3166 | |||
3167 | fn f() { | ||
3168 | use m::Tr; | ||
3169 | |||
3170 | ().method(); | ||
3171 | //^^^^^^^^^^^ u8 | ||
3172 | } | ||
3173 | "#, | ||
3174 | ); | ||
3175 | } | ||
3176 | |||
3177 | #[test] | ||
3178 | fn inner_use_in_block() { | ||
3179 | check_types( | ||
3180 | r#" | ||
3181 | mod m { | ||
3182 | pub trait Tr { | ||
3183 | fn method(&self) -> u8 { 0 } | ||
3184 | } | ||
3185 | |||
3186 | impl Tr for () {} | ||
3187 | } | ||
3188 | |||
3189 | fn f() { | ||
3190 | { | ||
3191 | use m::Tr; | ||
3192 | |||
3193 | ().method(); | ||
3194 | //^^^^^^^^^^^ u8 | ||
3195 | } | ||
3196 | |||
3197 | { | ||
3198 | ().method(); | ||
3199 | //^^^^^^^^^^^ {unknown} | ||
3200 | } | ||
3201 | } | ||
3202 | "#, | ||
3203 | ); | ||
3204 | } | ||