1.1.0 (2021-07-14)
Language changes
- Support splat expansions inside tuple and array literals. (#10429, thanks @HertzDevil)
- Support breaks with values inside
while
expressions. (#10566, thanks @HertzDevil)
Macros
- Add
@top_level
to access the top-level scope in macros. (#10682, thanks @beta-ziliani) - Fix: preserve integer sizes in
NumberLiteral#int_bin_op
. (#10713, thanks @collidedscope) - Add
NumberLiteral#to_number
. (#10802, thanks @straight-shoota) - (breaking-change) Add
Crystal::Macros::Path#global?
deprecating the oldCrystal::Macros::Path#global
. (#10812, thanks @HertzDevil) - Minor fixes to docs of
UnaryExpression
macro nodes. (#10816, thanks @HertzDevil) - Add macro method
ASTNode#nil?
. (#10850, #10616, thanks @straight-shoota)
Standard library
Global changes
Windows support
- Port
Socket::Address
to win32 . (#10610, thanks @straight-shoota) - Port
Socket::Addrinfo
to win32. (#10650, thanks @straight-shoota) - Extract system-specifics from Socket. (#10706, thanks @straight-shoota)
- Make
WinError
portable and add it to prelude. (#10725, thanks @straight-shoota) - Improve portability of
SystemError
. (#10726, thanks @straight-shoota) - Refactor
Socket::Addrinfo::Error
based onos_error
. (#10761, thanks @straight-shoota) - Add
WinError.wsa_value
and specs forWinError
. (#10762, thanks @straight-shoota) - Add specs for
Errno
. (#10763, thanks @straight-shoota) - Refactor: Move win32 libc bindings from
winbase.cr
to approriate files. (#10771, thanks @straight-shoota) - Refactor: Change protocol socket fd to
Socket::Handle
. (#10772, thanks @straight-shoota) - Fix
Socket::Connect
error in addrinfo inheritos_error
. (#10782, thanks @straight-shoota) - Reorganize some win32 libc bindings (#10776, thanks @straight-shoota)
Type annotations
- Add type restriction to private
Process
constructor. (#7040, thanks @z64) - Add various return type restrictions (thanks @oprypin, @straight-shoota, and @caspiano):
#10578, #10579,
#10580, #10581,
#10582, #10583,
#10584, #10585,
#10586, #10587,
#10588, #10849,
#10856, #10857,
#10858, #10905 - Add type restrictions for splat-less overloads of some methods. (#10594, thanks @HertzDevil)
Numeric
- Add
Number.new
overload forString
. (#10422, thanks @Blacksmoke16) - Fix
Math.pw2ceil
for zero and 64-bit integers. (#10555, thanks @straight-shoota) - Add
#positive?
&#negative?
toNumber
andTime::Span
. (#10601, thanks @Blacksmoke16) - Fix imprecise
Number#significant
algorithm. (#10615, thanks @straight-shoota) - Add
BigFloat
's rounding modes. (#10618, thanks @HertzDevil) - Fix handling of arithmetic overflow in
BigDecimal#div
. (#10628, thanks @kellydanma) - Clarify behaviour of unsafe
Float
-to-number conversions. (#10631, thanks @HertzDevil) - Fix return type restriction for
Number#humanize
overload. (#10633, thanks @HertzDevil) - Fix
printf
float with with many digits. (#10719, thanks @straight-shoota) - Add
BigDecimal
's missing rounding modes. (#10798, thanks @HertzDevil) - Add support for using big rational
#**
with unsigned ints. (#10887, thanks @stakach) - Add overflow detection to
BigFloat#to_i64
and#to_u64
. (#10630, thanks @HertzDevil)
Text
- (performance) Optimize
Levenshtein.distance
. (#8324, thanks @r00ster91) - Refactor: add private
Slice#hexdump(io : IO)
overload. (#10496, thanks @HertzDevil) - Restrict
MatchData#begin
and#end
toInt32
. (#10656, thanks @straight-shoota) - Refactor: remove
#check_needs_resize
fromIO::Memory
,String::Builder
. (#10732, thanks @straight-shoota) - Fix
Base64#encode
, exclude last 3 bytes from bswap. (#10752, thanks @kostya) - Refactor: avoid union type in
Char::Reader#decode_char_at
. (#10758, thanks @asterite)
Collections
- Add sub/superset checking methods to
Hash
. (#7500, thanks @Sija) - Improve documentation of
Array#[](Range)
. (#10243, thanks @straight-shoota) - Add
Steppable
module as generalizedNumber#step
. (#10279, thanks @straight-shoota) - Add docs for
#map_with_index
. (#10512, thanks @wontruefree) - Add
Array#truncate
. (#10712, thanks @HertzDevil) - Fix: Always copy
Hash
's default block on#dup
and#clone
. (#10744, thanks @HertzDevil) - Apply
Array#push
's resizing heuristic to#unshift
. (#10750, thanks @HertzDevil) - Refactor index / count normalization in range-like methods. (#10753, thanks @HertzDevil)
- Add methods for cumulative folding and prefix sums. (#10789, thanks @HertzDevil)
- Fix: Pass read-only flag to peeked slice in
IO::Memory
. (#10891, thanks @z64)
Crypto
- Add methods for getting peer certificates and signatures in
OpenSSL
. (#8005, thanks @will) - Add docs for
OpenSSL::Cipher
. (#9934, thanks @sol-vin) - Fix format of
src/openssl/cipher.cr
. (#10705, thanks @straight-shoota) - Refine documentation for
Random#urlsafe_base64
. (#10724, thanks @straight-shoota) - Fix ssl context required for
add_x509_verify_flags
. (#10756, thanks @stakach)
Time
- Improve error handling for
load_localtime
on unix. (#10654, thanks @straight-shoota) - Fix broken call to
Time#to_s
. (#10778, thanks @straight-shoota) - Fix
Time#shift
cover date boundaries with zone offset. (#10871, thanks @straight-shoota)
Files
- Fix and unify documentation for
puts
. (#10614, thanks @straight-shoota) - Fix
Path#sibling
return type. (#10655, thanks @Sija) - Add
Path
inFileUtils
's methods to match the interfaces it's wrapping. (#10747, thanks @yb66) - Fix
FileDescriptor#pos
returnInt64
on armv6 (#10845, thanks @straight-shoota)
Fibers
- Clarify documentation on
Path#join
and#==
. (#10455, thanks @straight-shoota)
Networking
- Add an example middleware for
remote_address
. (#10408, thanks @oprypin) - Add
OAuth2::Client#http_client
. (#10452, thanks @straight-shoota) - Fix undefined constant error for
http/params
. (#10537, thanks @stakach) - Fix looping forever at 100% CPU if socket is closed. (#10658, thanks @didactic-drunk)
- Fix documentation of
HTTP::Cookies#[]=
empty path. (#10669, thanks @straight-shoota) - Fix handling of
EAI_SYSTEM
forgetaddrinfo
. (#10757, thanks @straight-shoota) - (performance) Cache
socket.local_address
andsocket.remote_address
. (#10765, thanks @lbguilherme) - Fix:
IO::ARGF#read
should always returni32
. (#10828, thanks @stakach) - Fix
HTTP::Cookie
parse quoted cookie value. (#10853, thanks @straight-shoota) - Add
Socket::Addrinfo#inspect
(#10775, thanks @straight-shoota)
System
- Fix sentence structure in
process.cr
. (#9259, thanks @matthewmcgarvey)
Runtime
- Implement segfault handler in Crystal. (#10463, thanks @maxfierke)
- Improve documentation for
Pointer.malloc
andGC
methods. (#10644, thanks @straight-shoota) - Add links to literal types in the language reference. (#10827, thanks @straight-shoota)
Serialization
- Add docs for some json methods. (#10257, thanks @rdp)
- Add
UUID.from_json_object_key?
. (#10517, thanks @kalinon) - Fix
JSON::Lexer
's UTF-16 escape sequence parsing. (#10450, thanks @HertzDevil) - Fix
YAML::Serializable.use_yaml_discriminator
with typed enum. (#10460, thanks @straight-shoota) - Fix YAML to not parse empty string as
nil
. (#10608, thanks @straight-shoota) - Add
UUID
to yaml parsing. (#10715, thanks @kalinon) - Fix double flushing json/yaml builders. (#10716, thanks @matthewmcgarvey)
Specs
- Add spec helper
it_iterates
for iteration methods. (#10158, #10797, thanks @straight-shoota) - Add usage instructions for spec runner to compiler. (#10046, thanks @straight-shoota)
- Fix: Handle invalid option errors on
crystal spec
. (#10787, thanks @hugopl) - Include
spec/**
in docs_main. (#10863, thanks @straight-shoota)
Compiler
- Add support for type var splats inside
Tuple
during generic parameter substitution. (#10232, thanks @HertzDevil) - Fix: consider free vars in parameters of abstract def implementations before existing types, in particular fixing the creation of empty types. (#10503, thanks @HertzDevil)
- Fix variance checks between generic instances for
Proc#call
and abstract defs. (#10507, #10899, thanks @HertzDevil) - Fix error message when default parameter value doesn't match non-type restriction. (#10515, thanks @HertzDevil)
- Fix type restriction logic for generic module instances. (#10519, thanks @HertzDevil)
- Fix logic for subclass restricted against uninstantiated nested generic superclass. (#10522, #10560, thanks @HertzDevil)
- Fix: eliminate extraneous types in certain non-commutative unions. (#10527, thanks @HertzDevil)
- Fix: exclude variables' final types inside
while true
if re-assigned before first break. (#10538, thanks @HertzDevil) - Make
Pointer(T)#value=
even stricter for generic arguments. (#10553, thanks @HertzDevil) - Fix body locations for def nodes that have default args . (#10619, thanks @oprypin)
- Fix call nodes' location after transforming its splats. (#10620, thanks @oprypin)
- Fix
check_type_allowed_as_proc_argument
to show the type name. (#10688, thanks @straight-shoota) - Add free variables to "no overload matches" errors. (#10692, thanks @HertzDevil)
- Fix: make virtual unbound types also unbound. (#10704, thanks @HertzDevil)
- Fix: run instance variable initializers on instantiated generic superclasses only. (#10729, thanks @HertzDevil)
- Fix: allow
previous_def
to init superclass's non-nilable ivars. (#10733, thanks @HertzDevil) - Fix: Use only last sub-expression of
Expressions
nodes for conditional type filters. (#10738, thanks @HertzDevil) - Fix: Don't compute type filters inside
typeof
's argument. (#10739, thanks @HertzDevil) - Fix: Devirtualize types in
TypeNode#==(other : TypeNode)
and#!=
. (#10742, thanks @HertzDevil) - Fix exit types of variables assigned inside
while
conditions. (#10759, thanks @HertzDevil) - Fix logic for
responds_to?
of generic module instances. (#10760, thanks @HertzDevil) - Add support for accessing a common value of a union type. (#10770, thanks @asterite)
- Fix subtype relation when generic type variable is a virtual abstract struct. (#10779, thanks @HertzDevil)
- Fix array literals consisting entirely of splat expansions. (#10792, thanks @HertzDevil)
- Fix parsing macro literal containing char literal. (#10799, thanks @straight-shoota)
- Refactor: Use type instead of
is_a?
in filters. (#10815, thanks @caspiano) - Expand named macro expression arguments before outer macro call expansion. (#10819, thanks @HertzDevil)
- Be more strict about printing operator calls as short forms. (#10825, thanks @HertzDevil)
- Fix union logic between metaclasses of uninstantiated generic classes in same hierarchy. (#10832, thanks @HertzDevil)
- Fix uninstantiated generic classes casting to themselves. (#10883, thanks @HertzDevil)
- Allow underscore in block return type even if the type can't be computed (#10933, thanks @asterite)
- Fix parser identifies call with named args as var (#10842, thanks @straight-shoota)
Tools
Formatter
- Fix: allow trailing space in parenthesized unions. (#10595, thanks @HertzDevil)
- Fix: don't consume newline after endless range literals. (#10596, thanks @HertzDevil)
- Fix indentation of heredocs relative to delimiter. (#10806, thanks @HertzDevil)
- Fix heredoc indent with outer indent. (#10867, thanks @straight-shoota)
Doc generator
- Fix escaping of argument lists in doc generator, expose JSON. (#10109, #10821, thanks @oprypin and @Sija)
- Print named generic type arguments of type restrictions in docs. (#10424, thanks @HertzDevil)
- Fix: respect overload order between methods. (#10609, thanks @HertzDevil)
- Fix
PropagateDocVisitor
visit macro def. (#10634, thanks @straight-shoota) - Fix: remove superclass from
ASTNode
in API docs. (#10664, thanks @beta-ziliani) - (breaking-change) Remove deprecated
ditto
doc directive. (#10755, thanks @caspiano)
(Note that it was scheduled for removal since 0.34) - Fix: Restrict macro types' ancestors to
ASTNode
. (#10722, thanks @HertzDevil) - Fix docs generator search use
html_id
. (#10875, thanks @straight-shoota) - Fix
--sitemap-priority
,--sitemap-changefreq
. (#10906, thanks @HertzDevil)
Others
- CI: Update to use 1.0.0. (#10533, thanks @bcardiff)
- Bump distribution-scripts. (#10639, #10673, #10754, thanks @straight-shoota and @bcardiff)
- Fix contribution instructions. (#10558, thanks @straight-shoota)
- Remove
.dockerignore
. (#10642, thanks @miry) - Add section about pull requests to the contributing guide. (#10683, thanks @straight-shoota)
- Publish nightly builds to OBS. (#10684, thanks @straight-shoota)
- Remove broken travis.yml config from
crystal init
. (#10800, thanks @straight-shoota) - Disable broken
test_darwin
job on circleci. (#10823, thanks @straight-shoota) - Update distribution-scripts for shards 0.15.0. (#10862, thanks @straight-shoota)
- Add smoke tests for platforms where we don't run full tests (#10848, thanks @straight-shoota)