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

Message ID 20230405140411.3016563-18-arthur.cohen@embecosm.com
State Accepted
Headers
Series [committed,01/88] gccrs: fatal_error_flag: Fix typo in error message |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Arthur Cohen April 5, 2023, 2:03 p.m. UTC
  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(-)
  

Patch

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