Use a single quote instead of a backtick for error messages
Fix https://bugs.ruby-lang.org/issues/20977
This commit is contained in:
parent
8a9f1e600f
commit
c8e3d745fa
Notes:
git
2025-01-06 01:51:14 +00:00
@ -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 },
|
||||
|
4
proc.c
4
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.
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user