Find pattern is no longer experimental [Feature #18585]
This commit is contained in:
parent
3200d97e95
commit
db6b23c76c
4
NEWS.md
4
NEWS.md
@ -45,6 +45,9 @@ Note that each entry is kept to a minimum, see links for details.
|
|||||||
|
|
||||||
[[Bug #15928]]
|
[[Bug #15928]]
|
||||||
|
|
||||||
|
* Find pattern is no longer experimental.
|
||||||
|
[[Feature #18585]]
|
||||||
|
|
||||||
## Command line options
|
## Command line options
|
||||||
|
|
||||||
## Core classes updates
|
## Core classes updates
|
||||||
@ -164,3 +167,4 @@ The following deprecated APIs are removed.
|
|||||||
[Bug #17545]: https://bugs.ruby-lang.org/issues/17545
|
[Bug #17545]: https://bugs.ruby-lang.org/issues/17545
|
||||||
[Feature #17881]: https://bugs.ruby-lang.org/issues/17881
|
[Feature #17881]: https://bugs.ruby-lang.org/issues/17881
|
||||||
[Feature #18351]: https://bugs.ruby-lang.org/issues/18351
|
[Feature #18351]: https://bugs.ruby-lang.org/issues/18351
|
||||||
|
[Feature #18585]: https://bugs.ruby-lang.org/issues/18585
|
||||||
|
3
parse.y
3
parse.y
@ -4356,9 +4356,6 @@ p_args_tail : p_rest
|
|||||||
p_find : p_rest ',' p_args_post ',' p_rest
|
p_find : p_rest ',' p_args_post ',' p_rest
|
||||||
{
|
{
|
||||||
$$ = new_find_pattern_tail(p, $1, $3, $5, &@$);
|
$$ = new_find_pattern_tail(p, $1, $3, $5, &@$);
|
||||||
|
|
||||||
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL))
|
|
||||||
rb_warn0L_experimental(nd_line($$), "Find pattern is experimental, and the behavior may change in future versions of Ruby!");
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
experimental, Warning[:experimental] = Warning[:experimental], false # suppress "warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!"
|
|
||||||
eval "\n#{<<~'END_of_GUARD'}", binding, __FILE__, __LINE__
|
|
||||||
class TestPatternMatching < Test::Unit::TestCase
|
class TestPatternMatching < Test::Unit::TestCase
|
||||||
class NullFormatter
|
class NullFormatter
|
||||||
def message_for(corrections)
|
def message_for(corrections)
|
||||||
@ -1550,22 +1548,6 @@ END
|
|||||||
assert_equal false, (1 in 2)
|
assert_equal false, (1 in 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_experimental_warning(code)
|
|
||||||
w = Warning[:experimental]
|
|
||||||
|
|
||||||
Warning[:experimental] = false
|
|
||||||
assert_warn('') {eval(code)}
|
|
||||||
|
|
||||||
Warning[:experimental] = true
|
|
||||||
assert_warn(/is experimental/) {eval(code)}
|
|
||||||
ensure
|
|
||||||
Warning[:experimental] = w
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_experimental_warning
|
|
||||||
assert_experimental_warning("case [0]; in [*, 0, *]; end")
|
|
||||||
end
|
|
||||||
|
|
||||||
################################################################
|
################################################################
|
||||||
|
|
||||||
def test_single_pattern_error_value_pattern
|
def test_single_pattern_error_value_pattern
|
||||||
@ -1693,5 +1675,3 @@ END
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
END_of_GUARD
|
|
||||||
Warning[:experimental] = experimental
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user