merge revision(s) 117d6e145a0270ab8fc9134403519ef13b9ebb24: [Backport #21027]

[ruby/prism] Fix `not` receiver

	`not foo` should be `!foo`
	`not()` should be `!nil`

	Fixes [Bug #21027]

	https://github.com/ruby/prism/commit/871ed4b462
This commit is contained in:
nagachika 2025-04-06 11:24:36 +09:00
parent a1679f0d83
commit 7c315e2398
2 changed files with 4 additions and 3 deletions

View File

@ -15254,11 +15254,12 @@ parse_expression_prefix(pm_parser_t *parser, pm_binding_power_t binding_power, b
accept1(parser, PM_TOKEN_NEWLINE);
if (accept1(parser, PM_TOKEN_PARENTHESIS_LEFT)) {
arguments.opening_loc = PM_LOCATION_TOKEN_VALUE(&parser->previous);
pm_token_t lparen = parser->previous;
if (accept1(parser, PM_TOKEN_PARENTHESIS_RIGHT)) {
arguments.closing_loc = PM_LOCATION_TOKEN_VALUE(&parser->previous);
receiver = (pm_node_t *) pm_parentheses_node_create(parser, &lparen, NULL, &parser->previous);
} else {
arguments.closing_loc = PM_LOCATION_TOKEN_VALUE(&parser->previous);
receiver = parse_expression(parser, PM_BINDING_POWER_COMPOSITION, true, PM_ERR_NOT_EXPRESSION);
pm_conditional_predicate(receiver);

View File

@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 7
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 140
#define RUBY_PATCHLEVEL 141
#include "ruby/version.h"
#include "ruby/internal/abi.h"