diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-27 02:57:02 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-27 02:57:02 +0000 |
commit | c8066ebd1781a6f6f536abe3494477bd69df795a (patch) | |
tree | edf5109d9f0629b0910f4f2ac716bd624330bb00 /crates/hir_ty/src/infer | |
parent | 9c9376c4cffdd171375fbb21dd3d0f71a97a335e (diff) | |
parent | 8ce15b02dea7152953775904fd937cced2422bc6 (diff) |
Merge #8201
8201: Fix recursive macro statements expansion r=edwin0cheng a=edwin0cheng
This PR attempts to properly handle macro statement expansion by implementing the following:
1. Merge macro expanded statements to parent scope statements.
2. Add a new hir `Expr::MacroStmts` for handle tail expression infer.
PS : The scope of macro expanded statements are so strange that it took more time than I thought to understand and implement it :(
Fixes #8171
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 3f3187ea2..e6ede05ca 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -767,6 +767,7 @@ impl<'a> InferenceContext<'a> { | |||
767 | None => self.table.new_float_var(), | 767 | None => self.table.new_float_var(), |
768 | }, | 768 | }, |
769 | }, | 769 | }, |
770 | Expr::MacroStmts { tail } => self.infer_expr(*tail, expected), | ||
770 | }; | 771 | }; |
771 | // use a new type variable if we got unknown here | 772 | // use a new type variable if we got unknown here |
772 | let ty = self.insert_type_vars_shallow(ty); | 773 | let ty = self.insert_type_vars_shallow(ty); |