ruby/test
Étienne Barrié 12be40ae6b Implement chilled strings
[Feature #20205]

As a path toward enabling frozen string literals by default in the future,
this commit introduce "chilled strings". From a user perspective chilled
strings pretend to be frozen, but on the first attempt to mutate them,
they lose their frozen status and emit a warning rather than to raise a
`FrozenError`.

Implementation wise, `rb_compile_option_struct.frozen_string_literal` is
no longer a boolean but a tri-state of `enabled/disabled/unset`.

When code is compiled with frozen string literals neither explictly enabled
or disabled, string literals are compiled with a new `putchilledstring`
instruction. This instruction is identical to `putstring` except it marks
the String with the `STR_CHILLED (FL_USER3)` and `FL_FREEZE` flags.

Chilled strings have the `FL_FREEZE` flag as to minimize the need to check
for chilled strings across the codebase, and to improve compatibility with
C extensions.

Notes:
  - `String#freeze`: clears the chilled flag.
  - `String#-@`: acts as if the string was mutable.
  - `String#+@`: acts as if the string was mutable.
  - `String#clone`: copies the chilled flag.

Co-authored-by: Jean Boussier <byroot@ruby-lang.org>
2024-03-19 09:26:49 +01:00
..
-ext- Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
.excludes
.excludes-prism Skip warnings for duplicate keys 2024-03-16 00:09:29 +09:00
benchmark
cgi
coverage
date [ruby/date] Remove the unintentional ability to parse Symbol 2024-02-21 16:04:52 +00:00
did_you_mean Do not include a backtick in error messages and backtraces 2024-02-15 18:42:31 +09:00
digest
dtrace
erb
error_highlight Do not include a backtick in error messages and backtraces 2024-02-15 18:42:31 +09:00
etc
fiber Use exit 0 instead of true on windows platform 2024-01-24 18:00:12 +09:00
fiddle suppress a warning 2023-12-25 22:15:25 +09:00
fileutils
io [ruby/io-console] Move the condition to omit to command line option 2024-01-30 19:19:23 +09:00
irb [ruby/irb] Fix irb_history saved to current directory 2024-03-16 15:20:03 +00:00
json [flori/json] Make OpenStruct support as optional 2024-01-31 14:56:00 +09:00
lib
logger
mkmf
monitor ensure to restart antoher thread 2023-12-23 05:56:02 +09:00
net Fix test session reuse but expire (#9824) 2024-02-07 10:59:59 +09:00
objspace Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
open-uri [ruby/open-uri] Set default for max_redirects and add exception class 2023-12-07 07:00:54 +00:00
openssl [ruby/openssl] test_provider.rb: Make a legacy provider test optional. 2024-03-13 15:47:27 +00:00
optparse [ruby/optparse] Invoke pager for --help 2024-03-01 07:10:08 +00:00
ostruct
pathname
prism [PRISM] Resync 2024-03-18 09:58:53 -04:00
psych [ruby/psych] Add :stringify_names option to convert symbol keys to string for dumping 2024-01-18 17:32:34 +00:00
rdoc [ruby/rdoc] test: Add tests for RDoc::TokenStream#add_tokens, add_token ,collect_tokens and pop_token 2024-03-15 00:10:14 +00:00
reline [ruby/reline] C for vi mode 2024-02-13 18:57:17 +09:00
resolv [ruby/resolv] Implement CAA resource record 2024-02-29 20:55:26 +00:00
ripper [Feature #20257] Rearchitect Ripper 2024-02-20 17:33:58 +09:00
ruby Implement chilled strings 2024-03-19 09:26:49 +01:00
rubygems [rubygems/rubygems] Bump rb-sys 2024-03-08 12:27:31 +09:00
set
socket Revise 9ec342e07d 2024-02-26 13:12:05 +09:00
stringio [ruby/stringio] NULL StringIO by StringIO.new(nil) 2024-03-15 04:34:14 +00:00
strscan [ruby/strscan] Add a method for peeking and reading bytes as 2024-02-26 15:54:54 +09:00
uri [ruby/uri] Make URI#to_s prepend relative path with / if there is a host or port 2024-01-05 16:07:55 +00:00
win32ole [ruby/win32ole] Use the scoped names in the tests 2024-01-28 15:25:35 +00:00
yaml [ruby/yaml] Make PStore support as optional 2024-01-31 05:56:39 +00:00
zlib [ruby/zlib] In Zlib::GzipReader#eof? check if we're actually at eof 2024-02-22 06:42:06 +00:00
runner.rb
test_delegate.rb
test_extlibs.rb Extract syslog 2024-01-22 15:59:40 +09:00
test_find.rb
test_forwardable.rb [ruby/forwardable] Relax regexp for Ruby 3.3 or before 2024-02-16 02:12:08 +00:00
test_ipaddr.rb [ruby/ipaddr] Consider IPv4-mapped IPv6 addresses link local/loopback if IPV4 address is private 2023-12-25 21:12:49 +09:00
test_open3.rb
test_pp.rb [ruby/pp] Extract pp_hash_pair 2024-02-21 16:45:01 +00:00
test_prettyprint.rb
test_pstore.rb
test_pty.rb
test_rbconfig.rb
test_securerandom.rb
test_shellwords.rb
test_singleton.rb
test_tempfile.rb
test_time.rb
test_timeout.rb
test_tmpdir.rb
test_trick.rb Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
test_tsort.rb
test_unicode_normalize.rb
test_weakref.rb