Skip to content

Commit 8414c26

Browse files
committed
[PRISM] Make prism compiler warning experimental
1 parent f5801e2 commit 8414c26

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ruby.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,10 +1408,6 @@ proc_long_options(ruby_cmdline_options_t *opt, const char *s, long argc, char **
14081408
else if (is_option_with_arg("parser", Qfalse, Qtrue)) {
14091409
if (strcmp("prism", s) == 0) {
14101410
(*rb_ruby_prism_ptr()) = true;
1411-
rb_warn("The compiler based on the Prism parser is currently experimental and "
1412-
"compatibility with the compiler based on parse.y "
1413-
"is not yet complete. Please report any issues you "
1414-
"find on the `ruby/prism` issue tracker.");
14151411
}
14161412
else if (strcmp("parse.y", s) == 0) {
14171413
// default behavior
@@ -2089,6 +2085,16 @@ prism_script(ruby_cmdline_options_t *opt, pm_parse_result_t *result)
20892085
{
20902086
ruby_opt_init(opt);
20912087

2088+
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) {
2089+
rb_category_warn(
2090+
RB_WARN_CATEGORY_EXPERIMENTAL,
2091+
"The compiler based on the Prism parser is currently experimental "
2092+
"and compatibility with the compiler based on parse.y is not yet "
2093+
"complete. Please report any issues you find on the `ruby/prism` "
2094+
"issue tracker."
2095+
);
2096+
}
2097+
20922098
memset(result, 0, sizeof(*result));
20932099
result->options.line = 1;
20942100

test/ruby/test_rubyoptions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def test_parser_flag
302302

303303
assert_in_out_err(%w(--parser=notreal -e) + ["puts :hi"], "", [], /unknown parser notreal/)
304304

305-
assert_in_out_err(%w(--parser=prism --version), "", /\+PRISM/, warning)
305+
assert_in_out_err(%w(--parser=prism --version), "", /\+PRISM/, [])
306306
end
307307

308308
def test_eval

0 commit comments

Comments
 (0)