diff options
author | Florian Diebold <[email protected]> | 2021-05-13 19:31:06 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-05-21 16:48:34 +0100 |
commit | afa6be243587e523d5a2fc218db78568041ff296 (patch) | |
tree | 7e2fae0c138e3031b3f3530073f80399159964d5 /crates/hir_ty/src | |
parent | 3379a52dffc2d0951892edd93233b8069395de61 (diff) |
Update tests with expected changes
Diffstat (limited to 'crates/hir_ty/src')
-rw-r--r-- | crates/hir_ty/src/infer/unify.rs | 3 | ||||
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 71 |
2 files changed, 34 insertions, 40 deletions
diff --git a/crates/hir_ty/src/infer/unify.rs b/crates/hir_ty/src/infer/unify.rs index 896d084f4..e7718aa22 100644 --- a/crates/hir_ty/src/infer/unify.rs +++ b/crates/hir_ty/src/infer/unify.rs | |||
@@ -295,7 +295,6 @@ impl<'a> InferenceTable<'a> { | |||
295 | |ty, _| match ty.kind(&Interner) { | 295 | |ty, _| match ty.kind(&Interner) { |
296 | &TyKind::InferenceVar(tv, kind) => { | 296 | &TyKind::InferenceVar(tv, kind) => { |
297 | if tv_stack.contains(&tv) { | 297 | if tv_stack.contains(&tv) { |
298 | cov_mark::hit!(type_var_cycles_resolve_as_possible); | ||
299 | // recursive type | 298 | // recursive type |
300 | return self.type_variable_table.fallback_value(tv, kind); | 299 | return self.type_variable_table.fallback_value(tv, kind); |
301 | } | 300 | } |
@@ -366,7 +365,6 @@ mod resolve { | |||
366 | ) -> Fallible<Ty> { | 365 | ) -> Fallible<Ty> { |
367 | let var = self.var_unification_table.inference_var_root(var); | 366 | let var = self.var_unification_table.inference_var_root(var); |
368 | if self.var_stack.contains(&var) { | 367 | if self.var_stack.contains(&var) { |
369 | cov_mark::hit!(type_var_cycles_resolve_as_possible); | ||
370 | // recursive type | 368 | // recursive type |
371 | let default = self.type_variable_table.fallback_value(var, kind).cast(&Interner); | 369 | let default = self.type_variable_table.fallback_value(var, kind).cast(&Interner); |
372 | return Ok((self.fallback)(var, VariableKind::Ty(kind), default, outer_binder) | 370 | return Ok((self.fallback)(var, VariableKind::Ty(kind), default, outer_binder) |
@@ -403,7 +401,6 @@ mod resolve { | |||
403 | .intern(&Interner) | 401 | .intern(&Interner) |
404 | .cast(&Interner); | 402 | .cast(&Interner); |
405 | if self.var_stack.contains(&var) { | 403 | if self.var_stack.contains(&var) { |
406 | cov_mark::hit!(type_var_cycles_resolve_as_possible); | ||
407 | // recursive | 404 | // recursive |
408 | return Ok((self.fallback)(var, VariableKind::Const(ty), default, outer_binder) | 405 | return Ok((self.fallback)(var, VariableKind::Const(ty), default, outer_binder) |
409 | .assert_const_ref(&Interner) | 406 | .assert_const_ref(&Interner) |
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 431861712..59a16f390 100644 --- a/crates/hir_ty/src/tests/regression.rs +++ b/crates/hir_ty/src/tests/regression.rs | |||
@@ -86,8 +86,6 @@ fn bug_651() { | |||
86 | 86 | ||
87 | #[test] | 87 | #[test] |
88 | fn recursive_vars() { | 88 | fn recursive_vars() { |
89 | cov_mark::check!(type_var_cycles_resolve_completely); | ||
90 | cov_mark::check!(type_var_cycles_resolve_as_possible); | ||
91 | check_infer( | 89 | check_infer( |
92 | r#" | 90 | r#" |
93 | fn test() { | 91 | fn test() { |
@@ -97,12 +95,12 @@ fn recursive_vars() { | |||
97 | "#, | 95 | "#, |
98 | expect![[r#" | 96 | expect![[r#" |
99 | 10..47 '{ ...&y]; }': () | 97 | 10..47 '{ ...&y]; }': () |
100 | 20..21 'y': &{unknown} | 98 | 20..21 'y': {unknown} |
101 | 24..31 'unknown': &{unknown} | 99 | 24..31 'unknown': {unknown} |
102 | 37..44 '[y, &y]': [&&{unknown}; 2] | 100 | 37..44 '[y, &y]': [{unknown}; 2] |
103 | 38..39 'y': &{unknown} | 101 | 38..39 'y': {unknown} |
104 | 41..43 '&y': &&{unknown} | 102 | 41..43 '&y': &{unknown} |
105 | 42..43 'y': &{unknown} | 103 | 42..43 'y': {unknown} |
106 | "#]], | 104 | "#]], |
107 | ); | 105 | ); |
108 | } | 106 | } |
@@ -119,19 +117,19 @@ fn recursive_vars_2() { | |||
119 | "#, | 117 | "#, |
120 | expect![[r#" | 118 | expect![[r#" |
121 | 10..79 '{ ...x)]; }': () | 119 | 10..79 '{ ...x)]; }': () |
122 | 20..21 'x': &&{unknown} | 120 | 20..21 'x': {unknown} |
123 | 24..31 'unknown': &&{unknown} | 121 | 24..31 'unknown': {unknown} |
124 | 41..42 'y': &&{unknown} | 122 | 41..42 'y': {unknown} |
125 | 45..52 'unknown': &&{unknown} | 123 | 45..52 'unknown': {unknown} |
126 | 58..76 '[(x, y..., &x)]': [(&&&{unknown}, &&&{unknown}); 2] | 124 | 58..76 '[(x, y..., &x)]': [({unknown}, {unknown}); 2] |
127 | 59..65 '(x, y)': (&&&{unknown}, &&&{unknown}) | 125 | 59..65 '(x, y)': ({unknown}, {unknown}) |
128 | 60..61 'x': &&{unknown} | 126 | 60..61 'x': {unknown} |
129 | 63..64 'y': &&{unknown} | 127 | 63..64 'y': {unknown} |
130 | 67..75 '(&y, &x)': (&&&{unknown}, &&&{unknown}) | 128 | 67..75 '(&y, &x)': (&{unknown}, &{unknown}) |
131 | 68..70 '&y': &&&{unknown} | 129 | 68..70 '&y': &{unknown} |
132 | 69..70 'y': &&{unknown} | 130 | 69..70 'y': {unknown} |
133 | 72..74 '&x': &&&{unknown} | 131 | 72..74 '&x': &{unknown} |
134 | 73..74 'x': &&{unknown} | 132 | 73..74 'x': {unknown} |
135 | "#]], | 133 | "#]], |
136 | ); | 134 | ); |
137 | } | 135 | } |
@@ -165,7 +163,6 @@ fn infer_std_crash_1() { | |||
165 | 163 | ||
166 | #[test] | 164 | #[test] |
167 | fn infer_std_crash_2() { | 165 | fn infer_std_crash_2() { |
168 | cov_mark::check!(type_var_resolves_to_int_var); | ||
169 | // caused "equating two type variables, ...", taken from std | 166 | // caused "equating two type variables, ...", taken from std |
170 | check_infer( | 167 | check_infer( |
171 | r#" | 168 | r#" |
@@ -257,27 +254,27 @@ fn infer_std_crash_5() { | |||
257 | expect![[r#" | 254 | expect![[r#" |
258 | 26..322 '{ ... } }': () | 255 | 26..322 '{ ... } }': () |
259 | 32..320 'for co... }': () | 256 | 32..320 'for co... }': () |
260 | 36..43 'content': &{unknown} | 257 | 36..43 'content': {unknown} |
261 | 47..60 'doesnt_matter': {unknown} | 258 | 47..60 'doesnt_matter': {unknown} |
262 | 61..320 '{ ... }': () | 259 | 61..320 '{ ... }': () |
263 | 75..79 'name': &&{unknown} | 260 | 75..79 'name': &{unknown} |
264 | 82..166 'if doe... }': &&{unknown} | 261 | 82..166 'if doe... }': &{unknown} |
265 | 85..98 'doesnt_matter': bool | 262 | 85..98 'doesnt_matter': bool |
266 | 99..128 '{ ... }': &&{unknown} | 263 | 99..128 '{ ... }': &{unknown} |
267 | 113..118 'first': &&{unknown} | 264 | 113..118 'first': &{unknown} |
268 | 134..166 '{ ... }': &&{unknown} | 265 | 134..166 '{ ... }': &{unknown} |
269 | 148..156 '&content': &&{unknown} | 266 | 148..156 '&content': &{unknown} |
270 | 149..156 'content': &{unknown} | 267 | 149..156 'content': {unknown} |
271 | 181..188 'content': &{unknown} | 268 | 181..188 'content': &{unknown} |
272 | 191..313 'if ICE... }': &{unknown} | 269 | 191..313 'if ICE... }': &{unknown} |
273 | 194..231 'ICE_RE..._VALUE': {unknown} | 270 | 194..231 'ICE_RE..._VALUE': {unknown} |
274 | 194..247 'ICE_RE...&name)': bool | 271 | 194..247 'ICE_RE...&name)': bool |
275 | 241..246 '&name': &&&{unknown} | 272 | 241..246 '&name': &&{unknown} |
276 | 242..246 'name': &&{unknown} | 273 | 242..246 'name': &{unknown} |
277 | 248..276 '{ ... }': &&{unknown} | 274 | 248..276 '{ ... }': &{unknown} |
278 | 262..266 'name': &&{unknown} | 275 | 262..266 'name': &{unknown} |
279 | 282..313 '{ ... }': &{unknown} | 276 | 282..313 '{ ... }': {unknown} |
280 | 296..303 'content': &{unknown} | 277 | 296..303 'content': {unknown} |
281 | "#]], | 278 | "#]], |
282 | ); | 279 | ); |
283 | } | 280 | } |
@@ -761,7 +758,7 @@ fn issue_4885() { | |||
761 | "#, | 758 | "#, |
762 | expect![[r#" | 759 | expect![[r#" |
763 | 136..139 'key': &K | 760 | 136..139 'key': &K |
764 | 198..214 '{ ...key) }': impl Future<Output = <K as Foo<R>>::Bar> | 761 | 198..214 '{ ...key) }': {unknown} |
765 | 204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> | 762 | 204..207 'bar': fn bar<R, K>(&K) -> impl Future<Output = <K as Foo<R>>::Bar> |
766 | 204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> | 763 | 204..212 'bar(key)': impl Future<Output = <K as Foo<R>>::Bar> |
767 | 208..211 'key': &K | 764 | 208..211 'key': &K |