[committed 17/88] gccrs: Add type resolution for grouped patterns

arthur.cohen@embecosm.com arthur.cohen@embecosm.com
Wed Apr 5 14:03:01 GMT 2023


From: Owen Avery <powerboat9.gamer@gmail.com>

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper
	visitor.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
---
 gcc/rust/typecheck/rust-hir-type-check-pattern.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index b017a851b5d..393f4158003 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -387,10 +387,12 @@ TypeCheckPattern::visit (HIR::IdentifierPattern &)
 }
 
 void
-TypeCheckPattern::visit (HIR::GroupedPattern &)
+TypeCheckPattern::visit (HIR::GroupedPattern &pattern)
 {
-  // TODO
-  gcc_unreachable ();
+  TyTy::BaseType *inner_ty
+    = TypeCheckPattern::Resolve (pattern.get_item ().get (), parent);
+  infered = inner_ty->clone ();
+  infered->set_ref (pattern.get_pattern_mappings ().get_hirid ());
 }
 
 void
-- 
2.40.0



More information about the Gcc-rust mailing list