From c8e3d745fabc2060a6e5c7342c881bb31f58f5f5 Mon Sep 17 00:00:00 2001 From: Junichi Ito Date: Sun, 22 Dec 2024 12:54:35 +0900 Subject: [PATCH] Use a single quote instead of a backtick for error messages Fix https://bugs.ruby-lang.org/issues/20977 --- prism/templates/src/diagnostic.c.erb | 4 ++-- proc.c | 4 ++-- test/prism/errors/it_with_ordinary_parameter.txt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/prism/templates/src/diagnostic.c.erb b/prism/templates/src/diagnostic.c.erb index c0ec69652f..ce98dc5acd 100644 --- a/prism/templates/src/diagnostic.c.erb +++ b/prism/templates/src/diagnostic.c.erb @@ -249,8 +249,8 @@ static const pm_diagnostic_data_t diagnostic_messages[PM_DIAGNOSTIC_ID_MAX] = { [PM_ERR_INVALID_VARIABLE_GLOBAL_3_3] = { "`%.*s' is not allowed as a global variable name", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_INVALID_VARIABLE_GLOBAL] = { "'%.*s' is not allowed as a global variable name", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_INVALID_YIELD] = { "Invalid yield", PM_ERROR_LEVEL_SYNTAX }, - [PM_ERR_IT_NOT_ALLOWED_NUMBERED] = { "`it` is not allowed when a numbered parameter is already used", PM_ERROR_LEVEL_SYNTAX }, - [PM_ERR_IT_NOT_ALLOWED_ORDINARY] = { "`it` is not allowed when an ordinary parameter is defined", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_IT_NOT_ALLOWED_NUMBERED] = { "'it' is not allowed when a numbered parameter is already used", PM_ERROR_LEVEL_SYNTAX }, + [PM_ERR_IT_NOT_ALLOWED_ORDINARY] = { "'it' is not allowed when an ordinary parameter is defined", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_LAMBDA_OPEN] = { "expected a `do` keyword or a `{` to open the lambda block", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_LAMBDA_TERM_BRACE] = { "expected a lambda block beginning with `{` to end with `}`", PM_ERROR_LEVEL_SYNTAX }, [PM_ERR_LAMBDA_TERM_END] = { "expected a lambda block beginning with `do` to end with `end`", PM_ERROR_LEVEL_SYNTAX }, diff --git a/proc.c b/proc.c index fdbec86eba..68f1bfc35c 100644 --- a/proc.c +++ b/proc.c @@ -4300,7 +4300,7 @@ proc_ruby2_keywords(VALUE procval) * [1, 2, 3].each { |x| p it } * # syntax error found (SyntaxError) * # [1, 2, 3].each { |x| p it } - * # ^~ `it` is not allowed when an ordinary parameter is defined + * # ^~ 'it' is not allowed when an ordinary parameter is defined * * But if a local name (variable or method) is available, it would be used: * @@ -4348,7 +4348,7 @@ proc_ruby2_keywords(VALUE procval) * Numbered parameters can't be mixed with +it+ either: * * [10, 20, 30].map { _1 + it } - * # SyntaxError: `it` is not allowed when a numbered parameter is already used + * # SyntaxError: 'it' is not allowed when a numbered parameter is already used * * To avoid conflicts, naming local variables or method * arguments +_1+, +_2+ and so on, causes an error. diff --git a/test/prism/errors/it_with_ordinary_parameter.txt b/test/prism/errors/it_with_ordinary_parameter.txt index 0fc34e9cc8..ff9c4276ca 100644 --- a/test/prism/errors/it_with_ordinary_parameter.txt +++ b/test/prism/errors/it_with_ordinary_parameter.txt @@ -1,3 +1,3 @@ proc { || it } - ^~ `it` is not allowed when an ordinary parameter is defined + ^~ 'it' is not allowed when an ordinary parameter is defined