[#106355] [Ruby master Bug#18373] RBS build failure: '/include/x86_64-linux/ruby/config.h', needed by 'constants.o'. — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18373 has been reported by vo.x (Vit Ondruch).

28 messages 2021/12/01

[#106356] [Ruby master Bug#18374] make: Circular spec/ruby/optional/capi/ext/array_spec.c <- spec/ruby/optional/capi/ext/array_spec.c dependency dropped. — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18374 has been reported by vo.x (Vit Ondruch).

8 messages 2021/12/01

[#106360] [Ruby master Feature#18376] Version comparison API — "vo.x (Vit Ondruch)" <noreply@...>

Issue #18376 has been reported by vo.x (Vit Ondruch).

28 messages 2021/12/01

[#106543] [Ruby master Bug#18396] An unexpected "hash value omission" syntax error when parentheses call expr follows — "koic (Koichi ITO)" <noreply@...>

Issue #18396 has been reported by koic (Koichi ITO).

10 messages 2021/12/08

[#106596] [Ruby master Misc#18399] DevMeeting-2022-01-13 — "mame (Yusuke Endoh)" <noreply@...>

Issue #18399 has been reported by mame (Yusuke Endoh).

11 messages 2021/12/09

[#106621] [Ruby master Misc#18404] 3.1 documentation problems tracking ticket — "zverok (Victor Shepelev)" <noreply@...>

Issue #18404 has been reported by zverok (Victor Shepelev).

16 messages 2021/12/11

[#106634] [Ruby master Bug#18407] Behavior difference between integer and string flags to File creation — deivid <noreply@...>

Issue #18407 has been reported by deivid (David Rodr鱈guez).

12 messages 2021/12/13

[#106644] [Ruby master Bug#18408] Rightward assignment into instance variable — "Dan0042 (Daniel DeLorme)" <noreply@...>

Issue #18408 has been reported by Dan0042 (Daniel DeLorme).

23 messages 2021/12/13

[#106686] [Ruby master Bug#18409] Crash (free(): invalid pointer) if LD_PRELOAD doesn't explicitly include libjemalloc.so.2 — "itay-grudev (Itay Grudev)" <noreply@...>

Issue #18409 has been reported by itay-grudev (Itay Grudev).

7 messages 2021/12/15

[#106730] [Ruby master Bug#18417] IO::Buffer problems — "zverok (Victor Shepelev)" <noreply@...>

Issue #18417 has been reported by zverok (Victor Shepelev).

9 messages 2021/12/19

[#106784] [CommonRuby Feature#18429] Configure ruby-3.0.3 on Solaris 10 Unknown keyword 'URL' in './ruby.tmp.pc' — "dklein (Dmitri Klein)" <noreply@...>

Issue #18429 has been reported by dklein (Dmitri Klein).

32 messages 2021/12/23

[#106828] [Ruby master Bug#18435] Calling `protected` on ancestor method changes result of `instance_methods(false)` — "ufuk (Ufuk Kayserilioglu)" <noreply@...>

Issue #18435 has been reported by ufuk (Ufuk Kayserilioglu).

23 messages 2021/12/26

[#106833] [Ruby master Feature#18438] Add `Exception#additional_message` to show additional error information — "mame (Yusuke Endoh)" <noreply@...>

Issue #18438 has been reported by mame (Yusuke Endoh).

30 messages 2021/12/27

[#106834] [Ruby master Bug#18439] Support YJIT for VC++ — "usa (Usaku NAKAMURA)" <noreply@...>

Issue #18439 has been reported by usa (Usaku NAKAMURA).

11 messages 2021/12/27

[#106851] [Ruby master Bug#18442] Make Ruby 3.0.3 on Solaris 10 with "The following command caused the error: cc -D_STDC_C99= " — "dklein (Dmitri Klein)" <noreply@...>

Issue #18442 has been reported by dklein (Dmitri Klein).

8 messages 2021/12/27

[#106928] [Ruby master Bug#18454] YJIT slowing down key Discourse benchmarks — "sam.saffron (Sam Saffron)" <noreply@...>

Issue #18454 has been reported by sam.saffron (Sam Saffron).

8 messages 2021/12/31

[ruby-core:106817] [Ruby master Bug#18432] case ... when bug if add a extra comma on the end of condition.

From: "zw963 (Wei Zheng)" <noreply@...>
Date: 2021-12-25 04:42:53 UTC
List: ruby-core #106817
Issue #18432 has been updated by zw963 (Wei Zheng).


mame (Yusuke Endoh) wrote in #note-1:
> ```
> case type
> when 'aaa',
>   x = 100
>   p x
> end
> ```
> 
> is parsed as
> 
> ```
> case type
> when 'aaa', (x = 100)
>   p x
> end
> ```
> 
> which is (almost) equivalent to
> 
> ```
> if 'aaa' === type || ((x = 100) === type)
>   p x
> end
> ```
> 
> . If `'aaa' === type` evaluates to true, `(x = 100)` is not executed. Thus, `x` is uninitialized, so it is nil by default.


Yes, i see now, but this behavior is a little oddness, from programming language perspective, this default behavior not good.

e.g. i add a binding.irb, like this, it so strange.


```rb
From: 1.rb @ line 7 :

     2: 
     3: case type
     4: when 'aaa',
     5:   x = 100
     6:   p x
 =>  7:   binding.irb
     8: when 'bbb'
     9:   x = 200
    10:   p x
    11: end

3.0.3 :001 > x
 => nil 


```

----------------------------------------
Bug #18432: case ... when bug if add a extra comma on the end of condition.
https://bugs.ruby-lang.org/issues/18432#change-95628

* Author: zw963 (Wei Zheng)
* Status: Open
* Priority: Normal
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I will describe how this bug happen for me.

1) I have code like this at first, it works!

```rb
type = 'aaa'

case type
when 'aaa'
  x = 100
  p x
when 'bbb'
  x = 100
  p x
end
# => 100
```


2) Because the code in when case 'aaa' or 'bbb', all code same, so, i do some refactor, it still work, like this:


```rb
type = 'aaa'

case type
when 'aaa', 'bbb'
  x = 100
  p x
end
# => 100
```

3) Then, logic is changes, i need split 'aaa' and 'bbb' back to original form, somethings is wrong!


```rb
type = 'aaa'

case type
when 'aaa',
  x = 100
  p x
when 'bbb'
  x = 200
  p x
end

# => nil
```

What i expected is raise syntax error, let me find this issue quickly, but, it just ignore silently.

4) In fact, it even no syntax error raised when i remove the second when.

```rb
type = 'aaa'

case type
when 'aaa',
  x = 100
  p x
 'bbb'
  x = 200
  p x
# nil
# 200
end

```

Following is disam ouput for case 3


```
== disasm: #<ISeq:<main>@1.rb:1 (1,0)-(10,3)> (catch: FALSE)
local table (size: 2, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1])
[ 2] type@0     [ 1] x@1
0000 putstring                              "aaa"                     (   1)[Li]
0002 setlocal_WC_0                          type@0
0004 getlocal_WC_0                          type@0                    (   3)[Li]
0006 dup                                                              (   4)
0007 putobject                              "aaa"
0009 checkmatch                             2
0011 branchif                               33
0013 dup                                                              (   5)
0014 putobject                              100
0016 dup
0017 setlocal_WC_0                          x@1
0019 checkmatch                             2
0021 branchif                               33
0023 dup                                                              (   7)
0024 putobject                              "bbb"
0026 checkmatch                             2
0028 branchif                               40
0030 pop                                                              (   3)
0031 putnil
0032 leave                                                            (   9)
0033 pop                                                              (   4)
0034 putself                                                          (   6)[Li]
0035 getlocal_WC_0                          x@1
0037 opt_send_without_block                 <calldata!mid:p, argc:1, FCALL|ARGS_SIMPLE>
0039 leave                                                            (   9)
0040 pop                                                              (   7)
0041 putobject                              200                       (   8)[Li]
0043 setlocal_WC_0                          x@1
0045 putself                                                          (   9)[Li]
0046 getlocal_WC_0                          x@1
0048 opt_send_without_block                 <calldata!mid:p, argc:1, FCALL|ARGS_SIMPLE>
```






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