From patchwork Wed Jun 3 08:02:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gaius Mulley X-Patchwork-Id: 136355 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 849CF4BA2E17 for ; Wed, 3 Jun 2026 08:03:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 849CF4BA2E17 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=s0lp6w2+ X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 417C44BA2E08 for ; Wed, 3 Jun 2026 08:02:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 417C44BA2E08 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 417C44BA2E08 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780473730; cv=none; b=fdW+Pjh/B2rgkzlU+Uccy8JDMNgafJXU9SFSZChsRd8siQdDhPJXjcrfpzE4jwDcikmCxwwzuRTOMD66DEUwm7CJV/zUT25p5ENhWJd2dAG9KxGclVjxrnkazbO/3+Swv9z7ewH2tyJLmw6MuCYug8PuuOJI1ZprC5n/Oy8zpow= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780473730; c=relaxed/simple; bh=8iG6/6gqm+TFf+ozRtI3peRKhl2TWSMzFXUEPkDVTLE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=I6zDqHMsGiiuEgDEWzxlPVLsu9mKIthndPYupUwMApg0wQHjYCx7T31Vk/W09jJIrhOFbI0O7tAXn5dDMYuU+zZZlCdAbv19FRI8RV3z05GCgFmxYG7n3GQitXCmLmOK7iWHqHjqOkwlCkpkAzR/lTgqoU1rXiTS3Nbvq0TwDLI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=s0lp6w2+ DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 417C44BA2E08 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-46019b190b6so1482180f8f.3 for ; Wed, 03 Jun 2026 01:02:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1780473729; x=1781078529; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fTTZ1W9foOLkzp2M2xuEmhUXmYALM6lXUNTuNqfo/pY=; b=s0lp6w2+UX1OELRrpkXkGXTyF905/B+Gd3AkRtlyCKiMHJDYvXjObxxZaVgDgC/J6F RwwUShlNmje9pMGN3vg37Mi3K5R4fw05dOnkiE/TgF98dlTLcelgqS3sXNE6wIevMZtf Igf2iLamcNMqjffYG+EMYS8CHHFbLaVrgkhw9FDpBPwzHRHYpHV9QBvhw4yBabmhou6q WwrPxWxIkIv/6PnLqRjTQDuw1C9LijB6LXQj3m6QgE2akdWKBIIPk5qaoGaLEh9yvk/z ySEQLUYxF/u1doTqMly+P07oY+xrv3rvPdQD36JEWkkDjrAG5eKe/We8DuTQMdWGdpwT UNvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780473729; x=1781078529; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fTTZ1W9foOLkzp2M2xuEmhUXmYALM6lXUNTuNqfo/pY=; b=EdvhqWmUqT5HlugvErOPydGaPG01Bkj/tJuUrnP5w+lPhCYpRVyW8KFo781eMEuUhn bP2QEmsVCLO4VoSsqmR3LEV4bm4gfzSJ3QwLcQaGFSmyra8/ibWkUFilcX1N9JM6mZMs iZYv40UvxgCbigGdeG5mNFnJN2vfxQ+klk3n4WWSbR6wZ6jRay8Ubeoe0jKIUpyPpp5v WRmolb+MpoRLnHDXeF3uETkve+1W/bbP2LAV01YNbL8lVc6bsJHnWdRQstxhyqN7sBZN dQX6Fvwx6M1vV/6MkBUkJd0x+jbFd67Sky9rxePsv4fVozifLSu6/aeJh+qKphcZuMP/ jcjw== X-Gm-Message-State: AOJu0YzMqfD9LrZZHsAiv1556DgwiQZ0e1LvHGo83Rtjq5QXu0rR5JMg /nMnC42RX7riuNtdfiMXtL1wXh0T8cWLVRF3+lyyNFOCX6iJJMPY53pdbhYIKQ== X-Gm-Gg: Acq92OE8Bfcr9aawOLwY/B9Y7SQRy74+WZsUspjEXS4YbN2dOHFHGYSOCSkiZzQIDeU DTTgjoZ63boF1tuP79v33FC1+hQqfRwx/L+7M3Y9T8t55fbXBP2T7NWLLoty4SY4FLBjjf1YDMj lwFaPb14PPEVDkjpqp6ZV13owraKjh0sMxpubNBMEpCe1YSPYWx/iS28GIiqrM3934IfFEimu/z fDx2V/wgvkWsApufUJvJ167V/IYtLGDwu7Z5Y+Zv+hyNF1PNgOdavygkt8ZHWn4ViLCmDD+lX22 RAh3elMEWgDutZ9HrWvyASC2enPg9IDcgrV6hWGMJtTPnpF2mdYIddLhoI8v96T8w1BiJlefYuA umpJP4+iPEEhfIi1mayyikVK2Ng+2p81fa4OB+FW5PZMhTQT71oefy65jU/riDSb6LUtEXaOAPa 6Jvam7SM4hGzcsERxnzK9PVG9P X-Received: by 2002:a5d:6411:0:b0:460:f4e:a481 with SMTP id ffacd0b85a97d-4602196e430mr2043989f8f.34.1780473728665; Wed, 03 Jun 2026 01:02:08 -0700 (PDT) Received: from gawain ([82.153.63.58]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4601f344541sm5156838f8f.22.2026.06.03.01.02.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jun 2026 01:02:07 -0700 (PDT) Received: from gaius by gawain with local (Exim 4.98.2) (envelope-from ) id 1wUgYA-0000000Gug9-2wzv; Wed, 03 Jun 2026 09:02:06 +0100 From: Gaius Mulley To: gcc-patches@gcc.gnu.org Cc: Gaius Mulley Subject: [pushed]PR modula2/125512: Candidate for spell checking missed when using qualified ident Date: Wed, 3 Jun 2026 09:02:02 +0100 Message-ID: <20260603080202.4031112-1-gaiusmod2@gmail.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_GMAIL_RCVD, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLOCKED shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org This bug fix checks the qualified ident processing for spell checking candidates. gcc/m2/ChangeLog: PR modula2/125512 * gm2-compiler/P3Build.bnf (SubDesignator): Rewrite to include spell checking. gcc/testsuite/ChangeLog: PR modula2/125512 * gm2.dg/spell/iso/fail/badmodule.mod: New test. * gm2.dg/spell/iso/fail/badrecord.mod: New test. * gm2.dg/spell/iso/fail/color.def: New test. Signed-off-by: Gaius Mulley --- gcc/m2/gm2-compiler/P3Build.bnf | 31 +++++++++++++------ .../gm2.dg/spell/iso/fail/badmodule.mod | 17 ++++++++++ .../gm2.dg/spell/iso/fail/badrecord.mod | 20 ++++++++++++ gcc/testsuite/gm2.dg/spell/iso/fail/color.def | 5 +++ 4 files changed, 63 insertions(+), 10 deletions(-) create mode 100644 gcc/testsuite/gm2.dg/spell/iso/fail/badmodule.mod create mode 100644 gcc/testsuite/gm2.dg/spell/iso/fail/badrecord.mod create mode 100644 gcc/testsuite/gm2.dg/spell/iso/fail/color.def diff --git a/gcc/m2/gm2-compiler/P3Build.bnf b/gcc/m2/gm2-compiler/P3Build.bnf index e1e96249ce7..ae067c4a02a 100644 --- a/gcc/m2/gm2-compiler/P3Build.bnf +++ b/gcc/m2/gm2-compiler/P3Build.bnf @@ -54,7 +54,7 @@ FROM DynamicStrings IMPORT String, InitString, KillString, Mark, ConCat, ConCatC FROM M2Printf IMPORT printf0, printf1 ; FROM M2Debug IMPORT Assert ; FROM P2SymBuild IMPORT BuildString, BuildNumber ; -FROM M2MetaError IMPORT MetaErrorT0, MetaErrorT2 ; +FROM M2MetaError IMPORT MetaErrorT0, MetaErrorT1, MetaErrorT2 ; FROM M2CaseList IMPORT ElseCase ; FROM M2StackSpell IMPORT GetRecordField ; @@ -174,8 +174,9 @@ FROM SymbolTable IMPORT MakeGnuAsm, PutGnuAsmVolatile, PutGnuAsm, PutGnuAsmInput PutIncluded, IsVarParam, IsProcedure, IsDefImp, IsModule, IsProcType, IsRecord, - RequestSym, IsExported, IsImported, - GetSym, GetLocalSym ; + RequestSym, IsExported, IsImported, IsUnknown, + GetSym, GetLocalSym, + UnknownReported ; FROM M2Batch IMPORT IsModuleKnown ; @@ -1115,25 +1116,35 @@ Designator := QualidentCheck % Che { SubDesignator } =: SubDesignator := "." % VAR Sym, Type, tok, - dotpostok : CARDINAL ; - name, n1 : Name ; % + dotpostok: CARDINAL ; + name : Name ; % % dotpostok := GetTokenNo () -1 ; PopTFtok (Sym, Type, tok) ; Type := SkipType(Type) ; PushTFtok(Sym, Type, tok) ; IF Type=NulSym THEN - n1 := GetSymName(Sym) ; IF IsModuleKnown(GetSymName(Sym)) THEN - WriteFormat2('%a looks like a module which has not been globally imported (eg. suggest that you IMPORT %a)', - n1, n1) + MetaErrorT1 (tok, '{%1a} looks like a module which has not been globally imported (eg. suggest that you IMPORT {%1a}', Sym) ELSE - WriteFormat1('%a is not a record variable', n1) + IF IsUnknown (Sym) + THEN + MetaErrorT1 (tok, 'the qualifier {%1Ua} is unknown {%1&siD}', Sym) ; + UnknownReported (Sym) + ELSE + MetaErrorT1 (tok, "the type of {%1ad} is not a record (but {%1tad})", Sym) + END END ELSIF NOT IsRecord(Type) THEN - MetaErrorT2 (tok, "the type of {%1ad} is not a record (but {%2ad}) and therefore it has no field", Sym, Type) ; + IF IsUnknown (Type) + THEN + MetaErrorT1 (tok, 'the qualifier {%1Ua} is unknown {%1&siD}', Type) ; + UnknownReported (Type) + ELSE + MetaErrorT2 (tok, "the type of {%1ad} is not a record (but {%2ad}) and therefore it has no field", Sym, Type) + END END ; StartScope(Type) % Ident diff --git a/gcc/testsuite/gm2.dg/spell/iso/fail/badmodule.mod b/gcc/testsuite/gm2.dg/spell/iso/fail/badmodule.mod new file mode 100644 index 00000000000..9e1972bd1bd --- /dev/null +++ b/gcc/testsuite/gm2.dg/spell/iso/fail/badmodule.mod @@ -0,0 +1,17 @@ + +(* { dg-do compile } *) +(* { dg-options "-g" } *) + +MODULE badmodule ; + +IMPORT color ; + +PROCEDURE Init ; +BEGIN + colors.Clear +(* { dg-error "the qualifier 'colors' is unknown, did you mean color?" "colors" { target *-*-* } 11 } *) +END Init ; + +BEGIN + Init +END badmodule. diff --git a/gcc/testsuite/gm2.dg/spell/iso/fail/badrecord.mod b/gcc/testsuite/gm2.dg/spell/iso/fail/badrecord.mod new file mode 100644 index 00000000000..8d9b8ccba82 --- /dev/null +++ b/gcc/testsuite/gm2.dg/spell/iso/fail/badrecord.mod @@ -0,0 +1,20 @@ + +(* { dg-do compile } *) +(* { dg-options "-g" } *) + +MODULE badrecord ; + +TYPE + color = RECORD + red, blue, green: CARDINAL ; + END ; + +PROCEDURE Init ; +BEGIN + colors.red := 1 ; +(* { dg-error "the qualifier 'colors' is unknown, did you mean color?" "colors" { target *-*-* } 14 } *) +END Init ; + +BEGIN + Init +END badrecord. diff --git a/gcc/testsuite/gm2.dg/spell/iso/fail/color.def b/gcc/testsuite/gm2.dg/spell/iso/fail/color.def new file mode 100644 index 00000000000..25fe68b8216 --- /dev/null +++ b/gcc/testsuite/gm2.dg/spell/iso/fail/color.def @@ -0,0 +1,5 @@ +DEFINITION MODULE color ; + +PROCEDURE Clear ; + +END color.