From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on starla X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from nue.mailmanlists.eu (nue.mailmanlists.eu [94.130.110.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id CA2AB1F57C for ; Wed, 14 May 2025 07:03:41 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (1024-bit key; unprotected) header.d=ml.ruby-lang.org header.i=@ml.ruby-lang.org header.a=rsa-sha256 header.s=mail header.b=uPgGiQas; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=RKYiy4kK; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ml.ruby-lang.org; s=mail; t=1747206202; bh=Qd3msFZ9Nc6yTj9K+PoaZGUxARkG/DoojbdDGgxj+2g=; h=Date:References:To:Reply-To:Subject:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From:Cc:From; b=uPgGiQas02q7yaXYgOry/Ksw7OiWDkYYuB11Gg5XkBI15GCjC6CJHouVKXRTWEp9h UESS3WwgJ9thdrygog4Kxe6r8r4cvrV52YMh5Byz0R+0oRmBfuXwWG0OXHzXCT6z/m Jh3nE0wtGefYuX7ZbfxXhv01U061fa0hNXCqm4EA= Received: from nue.mailmanlists.eu (localhost [IPv6:::1]) by nue.mailmanlists.eu (Postfix) with ESMTP id 9E78947500 for ; Wed, 14 May 2025 07:03:22 +0000 (UTC) Authentication-Results: nue.mailmanlists.eu; dkim=pass (2048-bit key; unprotected) header.d=ruby-lang.org header.i=@ruby-lang.org header.a=rsa-sha256 header.s=s1 header.b=RKYiy4kK; dkim-atps=neutral Received: from s.wfbtzhsv.outbound-mail.sendgrid.net (s.wfbtzhsv.outbound-mail.sendgrid.net [159.183.224.104]) by nue.mailmanlists.eu (Postfix) with ESMTPS id 03D9D474F0 for ; Wed, 14 May 2025 07:03:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ruby-lang.org; h=from:references:subject:mime-version:content-type: content-transfer-encoding:list-id:to:cc:content-type:from:subject:to; s=s1; bh=rJ8e5W4eR0IFy+hqlZOPo+iOxN27bLAOGsTxh810VIM=; b=RKYiy4kKewvpO5naRWor7DNBnaYinx8Bt3t1GOtKIyMv+F9t340jnIdkE6SiUvh9hlMg RlmjEqBVbmG/7ivl76D843JMEhM11TOBxZF0D9Er7lddRXbFVfbEO7DIP12L+7teGSeahQ 03Yb9r2knYSf6dYOq3p6reOC0+yB6GZwZhekbZngModrs1Ok9hjAsBKIplPDGtl8MPDdyj hSnPsTb0in1Bst1jQ2DkoqhM1f2Meu3getwC4MCa3JyqXTWV5VHW+1QPjl4OyTVW+hGMa3 PP4wV027JCPF/zxe/HM+BA9ucQnTY9fgqWztyhrd7ZwwNDoA7Ow7pwSH77J/NkYw== Received: by recvd-65bb6cdcb5-bxd6c with SMTP id recvd-65bb6cdcb5-bxd6c-1-68244033-19 2025-05-14 07:03:15.910674649 +0000 UTC m=+3056115.265792149 Received: from herokuapp.com (unknown) by geopod-ismtpd-7 (SG) with ESMTP id ZlLsypEkQhyaLZsZuqHDKg for ; Wed, 14 May 2025 07:03:15.901 +0000 (UTC) Date: Wed, 14 May 2025 07:03:15 +0000 (UTC) Message-ID: References: Mime-Version: 1.0 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 21337 X-Redmine-Issue-Author: koic X-Redmine-Issue-Assignee: Group (prism) X-Redmine-Issue-Priority: Normal X-Redmine-Sender: byroot X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-Redmine-MailingListIntegration-Message-Ids: 98845 X-SG-EID: =?us-ascii?Q?u001=2EKmNZ1u3n1vIpO8NNTdp+Q9c0ai7potxbEDLMO7SOJO=2F4KkRUz0d23466m?= =?us-ascii?Q?naiq=2F5fmA4hb60MdRMUAwHZnjIWVFu=2FrqiBOz5c?= =?us-ascii?Q?nOvkBudsSTg8KMjgQ7zYKQDJMIkOLYH3Y34U8ng?= =?us-ascii?Q?j3VsVgBGsfty2cwz5SdS6xHbKGyk5woDQNW81tc?= =?us-ascii?Q?vUWo6+a1SUF53rRhBCUPeWRQJXfJtIKhTiauBMo?= =?us-ascii?Q?WkfZxfLBn53xAeje08qHtj2VWJ1livZBfK1Ica=2F?= =?us-ascii?Q?cg=2FccHLbxgMGP8ZOGiAGBa9FoA=3D=3D?= To: ruby-core@ml.ruby-lang.org X-Entity-ID: u001.I8uzylDtAfgbeCOeLBYDww== Message-ID-Hash: 6CTQ7XPTBJ3DEUGD4565ESI33DKXLGAQ X-Message-ID-Hash: 6CTQ7XPTBJ3DEUGD4565ESI33DKXLGAQ X-MailFrom: bounces+313651-b711-ruby-core=ml.ruby-lang.org@em5188.ruby-lang.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list Reply-To: Ruby developers Subject: [ruby-core:122089] [Ruby Bug#21337] Using `not` on the RHS of a logical operator becomes valid syntax with Prism List-Id: Ruby developers Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: "byroot (Jean Boussier) via ruby-core" Cc: "byroot (Jean Boussier)" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Issue #21337 has been updated by byroot (Jean Boussier). Assignee set to prism ---------------------------------------- Bug #21337: Using `not` on the RHS of a logical operator becomes valid syntax with Prism https://bugs.ruby-lang.org/issues/21337#change-113243 * Author: koic (Koichi ITO) * Status: Open * Assignee: prism * ruby -v: ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [x86_64-darwin24] * Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN ---------------------------------------- The following syntax behavior differs between Ruby 3.3 (parse.y by default) and Ruby 3.4 (Prism by default). ```ruby if true && not true; end ``` ## Expected In Ruby 3.3 and earlier, the following code results in a syntax error. The default parser is `parse.y`. ```console $ ruby -vce 'if true && not true; end' ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-darwin24] -e:1: syntax error, unexpected `true', expecting '(' if true && not true; end ruby: compile error (SyntaxError) ``` The key point is that `not` is used on the right-hand side of a logical operator. ## Actual When the default parser is switched to Prism, it is accepted as valid syntax with Ruby 3.4+ (Prism by default): ```console $ ruby -vce 'if true && not true; end' ruby 3.4.3 (2025-04-14 revision d0b7e5b6a0) +PRISM [x86_64-darwin24] Syntax OK $ ruby -vce 'if true && not true; end' ruby 3.5.0dev (2025-05-13T02:05:19Z master 9b8c846bdf) +PRISM [x86_64-darwin24] Syntax OK ``` Specifying parse.y causes a syntax error, as before 3.3 (parse.y by default): ```console $ ruby -vce 'if true && not true; end' ruby 3.3.8 (2025-04-09 revision b200bad6cd) [x86_64-darwin24] -e:1: syntax error, unexpected `true', expecting '(' if true && not true; end ruby: compile error (SyntaxError) $ ruby --parser=parse.y -vce 'if true && not true; end' ruby 3.5.0dev (2025-05-13T02:05:19Z master 9b8c846bdf) [x86_64-darwin24] -e:1: syntax error, unexpected 'true', expecting '(' if true && not true; end ruby: compile error (SyntaxError) ``` The behavior seen in the parse.y producing a syntax error might be probably the expected one. Any case, it is likely that users would not expect such a discrepancy between parsers. This issue was noticed in the context of the following RuboCop issue: https://github.com/rubocop/rubocop/issues/14177 -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/