diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-05-21 18:51:53 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-05-21 18:51:53 +0100 |
commit | edbde25ca2f13ffacfd006ada7b38618d36d97c6 (patch) | |
tree | b1c5208c74ce56a36c8a9c454b9c479a3312ee94 /crates/hir_ty/src/tests/regression.rs | |
parent | de403b10448e23f232804596538de92fc57203d6 (diff) | |
parent | ef558c97d09b0be8639c92f490e5ad380aa04288 (diff) |
Merge #8856
8856: Use Chalk for unification r=flodiebold a=flodiebold
- use Chalk's unification, get rid of our own `unify`
- rewrite coercion to not use unification internals and to be more analogous to rustc
- fix various coercion bugs
- rewrite handling of obligations, since the old hacky optimization where we noted when an inference variable changes wasn't possible anymore
- stop trying to deeply resolve types all the time during inference, instead only do it shallowly where necessary
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/tests/regression.rs')
-rw-r--r-- | crates/hir_ty/src/tests/regression.rs | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs index 431861712..ad9edf11c 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 | } |