diff options
Diffstat (limited to 'crates/hir_ty')
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index d14f5c9bb..e23bd4da9 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -1050,3 +1050,52 @@ fn test() { | |||
1050 | "#]], | 1050 | "#]], |
1051 | ); | 1051 | ); |
1052 | } | 1052 | } |
1053 | |||
1054 | #[test] | ||
1055 | fn cfg_tail() { | ||
1056 | // https://github.com/rust-analyzer/rust-analyzer/issues/8378 | ||
1057 | check_infer( | ||
1058 | r#" | ||
1059 | fn fake_tail(){ | ||
1060 | { "first" } | ||
1061 | #[cfg(never)] 9 | ||
1062 | } | ||
1063 | fn multiple_fake(){ | ||
1064 | { "fake" } | ||
1065 | { "fake" } | ||
1066 | { "second" } | ||
1067 | #[cfg(never)] { 11 } | ||
1068 | #[cfg(never)] 12; | ||
1069 | #[cfg(never)] 13 | ||
1070 | } | ||
1071 | fn no_normal_tail(){ | ||
1072 | { "third" } | ||
1073 | #[cfg(never)] 14; | ||
1074 | #[cfg(never)] 15; | ||
1075 | } | ||
1076 | fn no_actual_tail(){ | ||
1077 | { "fourth" }; | ||
1078 | #[cfg(never)] 14; | ||
1079 | #[cfg(never)] 15 | ||
1080 | } | ||
1081 | "#, | ||
1082 | expect![[r#" | ||
1083 | 14..53 '{ ...)] 9 }': &str | ||
1084 | 20..31 '{ "first" }': &str | ||
1085 | 22..29 '"first"': &str | ||
1086 | 72..190 '{ ...] 13 }': &str | ||
1087 | 78..88 '{ "fake" }': &str | ||
1088 | 80..86 '"fake"': &str | ||
1089 | 93..103 '{ "fake" }': &str | ||
1090 | 95..101 '"fake"': &str | ||
1091 | 108..120 '{ "second" }': &str | ||
1092 | 110..118 '"second"': &str | ||
1093 | 210..273 '{ ... 15; }': &str | ||
1094 | 216..227 '{ "third" }': &str | ||
1095 | 218..225 '"third"': &str | ||
1096 | 293..357 '{ ...] 15 }': () | ||
1097 | 299..311 '{ "fourth" }': &str | ||
1098 | 301..309 '"fourth"': &str | ||
1099 | "#]], | ||
1100 | ) | ||
1101 | } | ||