From patchwork Wed Apr 5 14:03:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arthur Cohen X-Patchwork-Id: 79632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp341789vqo; Wed, 5 Apr 2023 07:16:51 -0700 (PDT) X-Google-Smtp-Source: AKy350Za2iGku9t4g82WJoP8j6uBvgZe+Zflj38S7hf0MV4Q6vd1H49CS90HEQ+ATXd6U79JzEG/ X-Received: by 2002:a17:906:3918:b0:947:94fb:3ac6 with SMTP id f24-20020a170906391800b0094794fb3ac6mr3130526eje.33.1680704211810; Wed, 05 Apr 2023 07:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680704211; cv=none; d=google.com; s=arc-20160816; b=mxICX44CcczxLcGo5+5Daey0Ga1f6OMED1qrusE+KXPzr7jJmgAILm9zHbYuind032 zRE1WcNzkmFHushP+AjLVtyV6mNzZb9w/KtIAdAcfte9ylsbQvmx/b2c6s7IlOR0KJGd JmRLE08BjcrwHHtDDcQ3ReDh3wrTTvGLWDAZTopfsj1IY5dYCkRpOiKUYBZBcbka/Hcu JtFbZd8w0IbPyvA4gChRf0oU/BGOfaFIKHXXFTYQ7wYBkgx6nYvoHF9xcXt+hyexhPS/ JXkjY0DD9NeCIROQ5zGmSCiVJKPaIZzWq9iMP5TLzhAZjDYQ+FA6c3KjOHui7p0UXqGK sn3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dmarc-filter :delivered-to; bh=kER+HgDwmN0dv1nYolUZqZjdHGtscx/yx91ms7Xn40U=; b=082yP4mZXO6RUWt9c/XPhxxmdBapNTfEqmbcOFS35D7kRLbVHaHOSUnsEb0s2qY5Oa H40O82e7aL0IPoQrjnEPGWYSmXZxu++/wG3vqBVOm6EBySQ5PJLsfHDhJDm/kzYbsKkt k08pO57GrH3eqdfMxjXassuKFdHm64NcF5vDAVs/znUtoZUR9ZWg+7X/Haj+TnWWJCHg IiBU+b+HRsMLQgh4uIFZRcFG1Vw4oPryGDk+XnhuczCfz6vRVeAPzGZzLzra2aiHaJbZ m82ESuYqW1cTKlEpG0eitPfWfHwls4j45yAFU4NPRsN8cUm/TRDAY1JTRT4J+L9dMuJl s1Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=aB0KO4td; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id u7-20020a17090626c700b009316b784857si1601945ejc.352.2023.04.05.07.16.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:16:51 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@embecosm.com header.s=google header.b=aB0KO4td; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B55D0396E431 for ; Wed, 5 Apr 2023 14:09:07 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 467F8385416E for ; Wed, 5 Apr 2023 14:05:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 467F8385416E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wr1-x42e.google.com with SMTP id t4so31097308wra.7 for ; Wed, 05 Apr 2023 07:05:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1680703539; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kER+HgDwmN0dv1nYolUZqZjdHGtscx/yx91ms7Xn40U=; b=aB0KO4tdHyxz2bmWdnCyNsJJQDPORF4HSY7ucDKmmIZ5W0LhJmbmJUogEJKVM9lzd/ cG/mPJ2oCR0HST6NJmGOtsn1p6T6DM9kR2q9B8ZzAheKuUqUO3A3C1gGNQj5B5esP9v5 5qJPLXswbGt0QKn9phtKkBZLEcNK/2vUP6ABfS4jnCiUYJxADnlhdyNrYi0Z6QJ0mIhH CkYoo8asaWTTBcsxA8P/1k1JYGmVrzYoW0CYDooDSrXhbcWNijyxs8smFK05BsTPAm9i lk7wyGEoY+MIFIbdFUr9loP01S3JdttnlVizDofm/rkCdfjikB5zI0eveU/7GUTBMX1p 1AuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680703539; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kER+HgDwmN0dv1nYolUZqZjdHGtscx/yx91ms7Xn40U=; b=kfLlhsknG2PPbsFKbfDrTaWhMnAAg13/BVRmvcWgO94xiSRjUGfqVzywF5VBfrZFlr 0wBM4d0eEPt7eUOBxN7nDtc8iDpvKO06+/9Wiloexl4OLt51DaHmcR0PnTQVJ0iFKO0f 9IiwfkIg8935JULGsqvoGjtWsKr9iuu9/fbHVn42ZPgZ4/0l+Lx5m6FotsW5A/SWWYr4 Ky8ifrjbAA1xkUBJpfCb1kC02BKtvLk63Z+r+WJ12jWkiw3YzLeGTAxD8mg+uaZ845VF 9huRXqsxPhQX9zTh7EuZz826raRNaNNR6dnYOTriLQ7vFVLEBJAXq/oI371T3CkFnUPr DzgQ== X-Gm-Message-State: AAQBX9ceKak5HExWrYDZYE950nakV3ZWnXs7fBLYcZ7TNSAtvP2kzLr+ +j6i3FPgGsZcEjbx/j8R/TK24rQucRgRl9FzYw== X-Received: by 2002:adf:f691:0:b0:2d6:6af:4891 with SMTP id v17-20020adff691000000b002d606af4891mr4376614wrp.3.1680703539638; Wed, 05 Apr 2023 07:05:39 -0700 (PDT) Received: from platypus.localdomain ([62.23.166.218]) by smtp.gmail.com with ESMTPSA id ay8-20020a05600c1e0800b003edddae1068sm2330150wmb.9.2023.04.05.07.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Apr 2023 07:05:39 -0700 (PDT) From: arthur.cohen@embecosm.com To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Owen Avery Subject: [committed 17/88] gccrs: Add type resolution for grouped patterns Date: Wed, 5 Apr 2023 16:03:01 +0200 Message-Id: <20230405140411.3016563-18-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com> References: <20230405140411.3016563-1-arthur.cohen@embecosm.com> MIME-Version: 1.0 X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: arthur.cohen@embecosm.com Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762346099725454551?= X-GMAIL-MSGID: =?utf-8?q?1762346099725454551?= From: Owen Avery gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Add proper visitor. Signed-off-by: Owen Avery --- 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