[#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
[ruby-core:106914] [Ruby master Bug#18449] Bug in 3.1 regexp literals with \c
From:
"jeremyevans0 (Jeremy Evans)" <noreply@...>
Date:
2021-12-30 04:21:05 UTC
List:
ruby-core #106914
Issue #18449 has been updated by jeremyevans0 (Jeremy Evans).
mame (Yusuke Endoh) wrote in #note-3:
> Looks like `\c?` in a regexp literal was changed for #14367.
>
> ```
> p(/\cC/.source) #=> "\\cC" in Ruby 3.0
> p(/\cC/.source) #=> "\\x03" in Ruby 3.1
> ```
>
> @jeremyevans0 What do you think?
As @janosch-x mentioned, the matched codepoints are the same. The fact that #source returns a different result does not seem like a bug/regression to me.
----------------------------------------
Bug #18449: Bug in 3.1 regexp literals with \c
https://bugs.ruby-lang.org/issues/18449#change-95734
* Author: zenspider (Ryan Davis)
* Status: Open
* Priority: Normal
* Target version: 3.1
* ruby -v: 3.1.0
----------------------------------------
This file passes on 2.7, 3.0, and fails (if you remove the `skip` line) on 3.1:
``` ruby
#!/usr/bin/env ruby -w
require "minitest/autorun"
class TestRegexpCreation < Minitest::Test
R31 = RUBY_VERSION > "3.1"
def test_literal_equivalence
if R31 then
assert_equal(/\x03/, /\cC/) # wrong! (note the assert)
else
refute_equal(/\x03/, /\cC/)
end
end
def test_from_literal
re = /\cC/
assert_equal(/\cC/, re)
if R31 then
assert_equal "\\x03", re.source # wrong?
else
assert_equal "\\cC", re.source
end
end
def test_from_source
re = Regexp.new "\\cC"
assert_equal "\\cC", re.source
if R31 then # wrong!
skip
assert_equal(/\cC/, re) # can't be written to pass
assert_equal(/\x03/, re) # can't be written to pass
else
assert_equal(/\cC/, re)
end
end
end
# on 3.1:
#
# if written as:
#
# assert_equal(/\x03/, re)
#
# it fails with:
#
# 1) Failure:
# TestRegexpCreation#test_source [regexp31.rb:32]:
# Expected: /\x03/
# Actual: /\cC/
#
# but if written as:
#
# assert_equal(/\cC/, re)
#
# it ALSO fails with:
#
# 1) Failure:
# TestRegexpCreation#test_source [regexp31.rb:32]:
# Expected: /\x03/
# Actual: /\cC/
```
--
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>