diff --git a/snapshots/dos_endings.txt b/snapshots/dos_endings.txt index 69d6b7cd7e..6ddb8b0a93 100644 --- a/snapshots/dos_endings.txt +++ b/snapshots/dos_endings.txt @@ -17,7 +17,7 @@ │ │ ├── flags: ∅ │ │ └── arguments: (length: 1) │ │ └── @ InterpolatedStringNode (location: (1,5)-(2,12)) - │ │ ├── flags: static_literal + │ │ ├── flags: ∅ │ │ ├── opening_loc: ∅ │ │ ├── parts: (length: 2) │ │ │ ├── @ StringNode (location: (1,5)-(1,9)) @@ -86,7 +86,7 @@ │ │ ├── flags: ∅ │ │ ├── receiver: │ │ │ @ InterpolatedStringNode (location: (17,8)-(17,14)) - │ │ │ ├── flags: static_literal + │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: (17,8)-(17,14) = "<<~EOF" │ │ │ ├── parts: (length: 2) │ │ │ │ ├── @ StringNode (location: (18,0)-(19,0)) diff --git a/snapshots/dstring.txt b/snapshots/dstring.txt index 7913cd010d..c136860fc4 100644 --- a/snapshots/dstring.txt +++ b/snapshots/dstring.txt @@ -41,7 +41,7 @@ │ │ └── closing_loc: (5,7)-(5,8) = "}" │ └── closing_loc: (5,8)-(5,9) = "\"" ├── @ InterpolatedStringNode (location: (7,0)-(9,2)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: ∅ │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (7,0)-(8,2)) diff --git a/snapshots/heredocs_leading_whitespace.txt b/snapshots/heredocs_leading_whitespace.txt index 6101cd02d3..0594f1c5dd 100644 --- a/snapshots/heredocs_leading_whitespace.txt +++ b/snapshots/heredocs_leading_whitespace.txt @@ -30,7 +30,7 @@ │ ├── closing_loc: (19,0)-(20,0) = " FOO\n" │ └── unescaped: "a\nb\n" ├── @ InterpolatedStringNode (location: (21,0)-(21,10)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (21,0)-(21,10) = "<<~' FOO'" │ ├── parts: (length: 2) │ │ ├── @ StringNode (location: (22,0)-(23,0)) @@ -47,7 +47,7 @@ │ │ └── unescaped: "b\n" │ └── closing_loc: (24,0)-(25,0) = " FOO\n" └── @ InterpolatedStringNode (location: (26,0)-(26,10)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (26,0)-(26,10) = "<<~' FOO'" ├── parts: (length: 2) │ ├── @ StringNode (location: (27,0)-(28,0)) diff --git a/snapshots/heredocs_nested.txt b/snapshots/heredocs_nested.txt index 08576915dc..c2d13e4bdb 100644 --- a/snapshots/heredocs_nested.txt +++ b/snapshots/heredocs_nested.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 2) ├── @ InterpolatedStringNode (location: (1,0)-(1,7)) - │ ├── flags: newline, static_literal, mutable + │ ├── flags: newline │ ├── opening_loc: (1,0)-(1,7) = "<<~RUBY" │ ├── parts: (length: 4) │ │ ├── @ StringNode (location: (2,0)-(3,0)) diff --git a/snapshots/heredocs_with_fake_newlines.txt b/snapshots/heredocs_with_fake_newlines.txt index df59b29b94..46892adc3d 100644 --- a/snapshots/heredocs_with_fake_newlines.txt +++ b/snapshots/heredocs_with_fake_newlines.txt @@ -12,7 +12,7 @@ │ ├── closing_loc: (13,0)-(14,0) = "RUBY\n" │ └── unescaped: " \n\n \n\n exit\n \\n\n \n\n\n\n\n argh\n \\\n \\ foo\nbar\n \f\n ok\n" ├── @ InterpolatedStringNode (location: (15,0)-(15,7)) - │ ├── flags: newline, static_literal + │ ├── flags: newline │ ├── opening_loc: (15,0)-(15,7) = "<<~RUBY" │ ├── parts: (length: 11) │ │ ├── @ StringNode (location: (16,0)-(17,0)) diff --git a/snapshots/heredocs_with_ignored_newlines.txt b/snapshots/heredocs_with_ignored_newlines.txt index 16675029e1..53b373fb3c 100644 --- a/snapshots/heredocs_with_ignored_newlines.txt +++ b/snapshots/heredocs_with_ignored_newlines.txt @@ -12,7 +12,7 @@ │ ├── closing_loc: (2,0)-(3,0) = "HERE\n" │ └── unescaped: "" └── @ InterpolatedStringNode (location: (4,0)-(4,8)) - ├── flags: newline, static_literal + ├── flags: newline ├── opening_loc: (4,0)-(4,8) = "<<~THERE" ├── parts: (length: 9) │ ├── @ StringNode (location: (5,0)-(6,0)) diff --git a/snapshots/seattlerb/difficult0_.txt b/snapshots/seattlerb/difficult0_.txt index 233440b101..da977bdc52 100644 --- a/snapshots/seattlerb/difficult0_.txt +++ b/snapshots/seattlerb/difficult0_.txt @@ -37,7 +37,7 @@ │ │ │ ├── flags: ∅ │ │ │ └── arguments: (length: 1) │ │ │ └── @ InterpolatedStringNode (location: (1,9)-(4,4)) - │ │ │ ├── flags: static_literal + │ │ │ ├── flags: ∅ │ │ │ ├── opening_loc: (1,9)-(1,10) = "'" │ │ │ ├── parts: (length: 2) │ │ │ │ ├── @ StringNode (location: (1,10)-(2,0)) diff --git a/snapshots/seattlerb/dstr_str.txt b/snapshots/seattlerb/dstr_str.txt index 7b3e0e36ad..adce0b18fe 100644 --- a/snapshots/seattlerb/dstr_str.txt +++ b/snapshots/seattlerb/dstr_str.txt @@ -6,7 +6,7 @@ ├── flags: ∅ └── body: (length: 1) └── @ InterpolatedStringNode (location: (1,0)-(1,10)) - ├── flags: newline, static_literal, mutable + ├── flags: newline ├── opening_loc: (1,0)-(1,1) = "\"" ├── parts: (length: 2) │ ├── @ EmbeddedStatementsNode (location: (1,1)-(1,7)) diff --git a/snapshots/seattlerb/heredoc_nested.txt b/snapshots/seattlerb/heredoc_nested.txt index 4820ef6d4d..7e1a2ffb23 100644 --- a/snapshots/seattlerb/heredoc_nested.txt +++ b/snapshots/seattlerb/heredoc_nested.txt @@ -6,10 +6,10 @@ ├── flags: ∅ └── body: (length: 1) └── @ ArrayNode (location: (1,0)-(7,2)) - ├── flags: newline, static_literal + ├── flags: newline ├── elements: (length: 2) │ ├── @ InterpolatedStringNode (location: (1,1)-(1,4)) - │ │ ├── flags: static_literal, mutable + │ │ ├── flags: ∅ │ │ ├── opening_loc: (1,1)-(1,4) = "<flags = (pm_node_flags_t) ((part->flags | PM_NODE_FLAG_STATIC_LITERAL | PM_STRING_FLAGS_FROZEN) & ~PM_STRING_FLAGS_MUTABLE); break; case PM_INTERPOLATED_STRING_NODE: diff --git a/test/prism/result/static_literals_test.rb b/test/prism/result/static_literals_test.rb index dcfc692897..cc07027916 100644 --- a/test/prism/result/static_literals_test.rb +++ b/test/prism/result/static_literals_test.rb @@ -4,6 +4,11 @@ module Prism class StaticLiteralsTest < TestCase + def test_concatenanted_string_literal_is_not_static + node = Prism.parse_statement("'a' 'b'") + refute_predicate node, :static_literal? + end + def test_static_literals assert_warning("1") assert_warning("0xA", "10", "10")