[#102393] [Ruby master Feature#17608] Compact and sum in one step — sawadatsuyoshi@...

Issue #17608 has been reported by sawa (Tsuyoshi Sawada).

13 messages 2021/02/04

[#102438] [Ruby master Bug#17619] if false foo=42; end creates a foo local variable set to nil — pkmuldoon@...

Issue #17619 has been reported by pkmuldoon (Phil Muldoon).

10 messages 2021/02/10

[#102631] [Ruby master Feature#17660] Expose information about which basic methods have been redefined — tenderlove@...

Issue #17660 has been reported by tenderlovemaking (Aaron Patterson).

9 messages 2021/02/27

[#102639] [Ruby master Misc#17662] The herdoc pattern used in tests does not syntax highlight correctly in many editors — eregontp@...

Issue #17662 has been reported by Eregon (Benoit Daloze).

13 messages 2021/02/27

[#102652] [Ruby master Bug#17664] Behavior of sockets changed in Ruby 3.0 to non-blocking — ciconia@...

Issue #17664 has been reported by ciconia (Sharon Rosner).

23 messages 2021/02/28

[ruby-core:102665] [Ruby master Bug#15932] wrong "void value expression" error for 'next' or 'break' statements inside an 'if' assignment

From: usa@...
Date: 2021-02-28 15:05:06 UTC
List: ruby-core #102665
Issue #15932 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.4: REQUIRED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: REQUIRED, 2.5: DONE, 2.6: REQUIRED

Backported into ruby_2_6 at r67903.

----------------------------------------
Bug #15932: wrong "void value expression" error for 'next' or 'break' statements inside an 'if' assignment
https://bugs.ruby-lang.org/issues/15932#change-90659

* Author: cvss (Kirill Vechera)
* Status: Closed
* Priority: Normal
* ruby -v: 1.8.7, 2.7.0preview1
* Backport: 2.4: REQUIRED, 2.5: DONE, 2.6: REQUIRED
----------------------------------------
When a 'next' or 'break' statement for block/loop control is placed inside an 'if' assignment, the parser outputs an error "void value expression". The same parsing error raises for the ternary operator in the same conditions.

I think, the the correct behavior should be consistent with the behavior of the 'case' statement, that is parsing such a code without errors and leaving the right-side variable with 'nil' value.

Examples of code giving a "void value expression" error:

1.

```
begin
	a = if false
		'A'
	else
		next
	end
end while false
```

2.
```
begin
	a = false ? 'A' : next
end while false
```

Example of code running without errors:

3.
```
begin
	a = case false
		when true
			'A'
		else
			next
		end
end while false
```

4.
```
begin
	a = (false or next)
end while false
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next