ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120363] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it'
@ 2024-12-22  4:04 jnchito (Junichi Ito) via ruby-core
  2024-12-22  4:07 ` [ruby-core:120364] " jnchito (Junichi Ito) via ruby-core
  2024-12-23 22:54 ` [ruby-core:120383] " alanwu (Alan Wu) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: jnchito (Junichi Ito) via ruby-core @ 2024-12-22  4:04 UTC (permalink / raw)
  To: ruby-core; +Cc: jnchito (Junichi Ito)

Issue #20977 has been reported by jnchito (Junichi Ito).

----------------------------------------
Bug #20977: backtick is used for syntax errors related to 'it'
https://bugs.ruby-lang.org/issues/20977

* Author: jnchito (Junichi Ito)
* Status: Open
* ruby -v: ruby 3.4.0rc1 (2024-12-12 master 29caae9991) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following error message uses single quote for "'it'":

``` 
irb(main):012> [10].each_with_index { p "#{it}:#{_2}" } #=> 10
irb(main):013> 
<internal:kernel>:168:in 'Kernel#loop': (irb):12: syntax error found (SyntaxError)
> 12 | ... _2}" } #=> 10
     |     ^~ numbered parameters are not allowed when 'it' is already used
  13 | 
  14 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'

```

However, the error below uses backtick:

```
irb(main):019* [1, 2, 3].map.with_index(10) do |n, i|
irb(main):020*   it * i
irb(main):021> end
<internal:kernel>:168:in 'Kernel#loop': (irb):20: syntax error found (SyntaxError)
  19 | [1, 2, 3].map.with_index(10) do |n, i|
> 20 |   it * i
     |   ^~ `it` is not allowed when an ordinary parameter is defined
  21 | end
  22 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'
```

So it should use single quote for consistency.




-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:120364] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it'
  2024-12-22  4:04 [ruby-core:120363] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it' jnchito (Junichi Ito) via ruby-core
@ 2024-12-22  4:07 ` jnchito (Junichi Ito) via ruby-core
  2024-12-23 22:54 ` [ruby-core:120383] " alanwu (Alan Wu) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: jnchito (Junichi Ito) via ruby-core @ 2024-12-22  4:07 UTC (permalink / raw)
  To: ruby-core; +Cc: jnchito (Junichi Ito)

Issue #20977 has been updated by jnchito (Junichi Ito).


My pull request is here:
https://github.com/ruby/ruby/pull/12424

----------------------------------------
Bug #20977: backtick is used for syntax errors related to 'it'
https://bugs.ruby-lang.org/issues/20977#change-111141

* Author: jnchito (Junichi Ito)
* Status: Open
* ruby -v: ruby 3.4.0rc1 (2024-12-12 master 29caae9991) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following error message uses single quote for "'it'":

``` 
irb(main):012> [10].each_with_index { p "#{it}:#{_2}" } #=> 10
irb(main):013> 
<internal:kernel>:168:in 'Kernel#loop': (irb):12: syntax error found (SyntaxError)
> 12 | ... _2}" } #=> 10
     |     ^~ numbered parameters are not allowed when 'it' is already used
  13 | 
  14 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'

```

However, the error below uses backtick:

```
irb(main):019* [1, 2, 3].map.with_index(10) do |n, i|
irb(main):020*   it * i
irb(main):021> end
<internal:kernel>:168:in 'Kernel#loop': (irb):20: syntax error found (SyntaxError)
  19 | [1, 2, 3].map.with_index(10) do |n, i|
> 20 |   it * i
     |   ^~ `it` is not allowed when an ordinary parameter is defined
  21 | end
  22 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'
```

So it should use single quote for consistency.




-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:120383] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it'
  2024-12-22  4:04 [ruby-core:120363] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it' jnchito (Junichi Ito) via ruby-core
  2024-12-22  4:07 ` [ruby-core:120364] " jnchito (Junichi Ito) via ruby-core
@ 2024-12-23 22:54 ` alanwu (Alan Wu) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: alanwu (Alan Wu) via ruby-core @ 2024-12-23 22:54 UTC (permalink / raw)
  To: ruby-core; +Cc: alanwu (Alan Wu)

Issue #20977 has been updated by alanwu (Alan Wu).

Assignee set to prism

----------------------------------------
Bug #20977: backtick is used for syntax errors related to 'it'
https://bugs.ruby-lang.org/issues/20977#change-111161

* Author: jnchito (Junichi Ito)
* Status: Open
* Assignee: prism
* ruby -v: ruby 3.4.0rc1 (2024-12-12 master 29caae9991) +PRISM [arm64-darwin24]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following error message uses single quote for "'it'":

``` 
irb(main):012> [10].each_with_index { p "#{it}:#{_2}" } #=> 10
irb(main):013> 
<internal:kernel>:168:in 'Kernel#loop': (irb):12: syntax error found (SyntaxError)
> 12 | ... _2}" } #=> 10
     |     ^~ numbered parameters are not allowed when 'it' is already used
  13 | 
  14 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'

```

However, the error below uses backtick:

```
irb(main):019* [1, 2, 3].map.with_index(10) do |n, i|
irb(main):020*   it * i
irb(main):021> end
<internal:kernel>:168:in 'Kernel#loop': (irb):20: syntax error found (SyntaxError)
  19 | [1, 2, 3].map.with_index(10) do |n, i|
> 20 |   it * i
     |   ^~ `it` is not allowed when an ordinary parameter is defined
  21 | end
  22 | 
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/lib/ruby/gems/3.4.0+1/gems/irb-1.14.1/exe/irb:9:in '<top (required)>'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in 'Kernel#load'
	from /Users/jnito/.rbenv/versions/3.4.0-rc1/bin/irb:25:in '<main>'
```

So it should use single quote for consistency.




-- 
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/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-12-23 22:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-22  4:04 [ruby-core:120363] [Ruby master Bug#20977] backtick is used for syntax errors related to 'it' jnchito (Junichi Ito) via ruby-core
2024-12-22  4:07 ` [ruby-core:120364] " jnchito (Junichi Ito) via ruby-core
2024-12-23 22:54 ` [ruby-core:120383] " alanwu (Alan Wu) via ruby-core

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).