[#104307] Float truncate — Eustáquio Rangel <eustaquiorangel@...>
Hi!
4 messages
2021/06/16
[ruby-core:104246] [Ruby master Bug#17950] Unable to pattern-match against a String key
From:
cardoso_tiago@...
Date:
2021-06-12 15:36:54 UTC
List:
ruby-core #104246
Issue #17950 has been reported by chucke (Tiago Cardoso).
----------------------------------------
Bug #17950: Unable to pattern-match against a String key
https://bugs.ruby-lang.org/issues/17950
* Author: chucke (Tiago Cardoso)
* Status: Open
* Priority: Normal
* ruby -v: 3.0.1
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
I'm unable to parse against an internal hash, when the internal hash contains strings as keys:
```ruby
case {status: 200, headers: {"content-type" => "application/json"}, body: "bla"}
in { status: , headers: {"content-type" => type}, body: }
# syntax error, unexpected terminator, expecting literal content or tSTRING_DBEG or tSTRING_DVAR or tLABEL_END
# ...tus: , headers: {"content-type" => type}, body: }
```
however, this works:
```ruby
h = {"content-type" => "application/json"}
case {status: 200, headers: {"content-type" => "application/json"}, body: "bla"}
in { status: , headers: ^h, body: }
```
--
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>