crystal v1.6.0 Release Notes

Release Date: 2022-10-06 // over 1 year ago
  • Language

    • Add 'wasm_import_module' option to the @[Link] annotation (#11935, thanks @lbguilherme)

    Standard Library

    • ๐Ÿ‘‰ Use GC.malloc_atomic with GC.realloc, not Pointer#realloc (#12391, thanks @HertzDevil)
    • ๐Ÿ‘Œ Improve syntax highlighter (#12409, thanks @I3oris)
    • ๐Ÿ Enable miscellaneous parts of the standard library on Windows (#12281, thanks @HertzDevil)
    • โœ… Use interpreter to run std spec tests (#12355, thanks @cyangle)
    • โœ‚ Remove most uses of Symbol variables in standard library specs (#12462, thanks @HertzDevil)
    • ๐Ÿ‘‰ Use @[::Primitive] and @[::Flags] where necessary (#11900, thanks @HertzDevil)
    • Document how to change base type of an enum (#9803, thanks @Blacksmoke16)
    • Spec: bump and document timeouts in interpreted mode (#12430, thanks @asterite)

    Collection

    • ๐Ÿ”จ Refactor and improve NamedTuple deserialization from JSON and YAML (#12008, thanks @HertzDevil)
    • ๐ŸŽ (performance) Optimize BitArray#tally(hash) (#11909, thanks @HertzDevil)
    • Use Slice#unsafe_slice_of and #to_unsafe_bytes in the standard library and compiler (#12280, thanks @HertzDevil)
    • ๐ŸŽ (performance) Optimize block-less overloads of BitArray#index and #rindex (#12087, thanks @HertzDevil)
    • ๐Ÿ‘Œ Support tuple metaclass indexers with non-literal arguments (#11834, thanks @HertzDevil)
    • โž• Add Indexable#index! overloads with offset parameter (#12089, thanks @HertzDevil)

    Concurrency

    • ๐Ÿ›  Fix fiber clean loop on Windows (#12300, thanks @HertzDevil)
    • ๐Ÿ Enable Mutex on Windows (#12213, thanks @HertzDevil)

    Crypto

    • โž• Add support for Bcrypt algorithm version 2y (#12447, thanks @docelic)
    • ๐Ÿ‘ Allow using U/Int128 in Random (#11977, thanks @BlobCodes)

    Files

    • (breaking-change) Define #system_echo and #system_raw on all systems (#12352, thanks @HertzDevil)
    • (breaking-change) Do not expose Crystal::System::FileInfo through File::Info (#12385, thanks @HertzDevil)
    • ๐Ÿ›  Fix IO.pipe spec on FreeBSD (#12324, thanks @dmgk)
    • ๐Ÿ›  Fix docs error for File.match? ** globbing pattern. (#12343, thanks @zw963)
    • โž• Add Dir#info (#11991, thanks @didactic-drunk)
    • ๐Ÿ Implement IO::FileDescriptor's console methods on Windows (#12294, thanks @HertzDevil)
    • ๐Ÿ”— Fix typo: LibC::DT_LINK -> DT_LNK (#11954, thanks @HertzDevil)
    • Document IO::FileDescriptor#info (#12384, thanks @HertzDevil)
    • ๐ŸŽ (performance) Introduce IO::DEFAULT_BUFFER_SIZE (#12507, thanks @straight-shoota)
    • โž• Add support for IO::FileDescriptor staying open on finalize (#12367, thanks @refi64)

    Macros

    • โœจ Enhance record documentation (#12334, thanks @straight-shoota)

    Networking

    • โž• Add Socket::IPAddress.valid? (#12489, #10492, thanks @straight-shoota)
    • ๐Ÿ›  Fix HTTP::Client#exec to abort retry when client was closed (#12465, thanks @straight-shoota)
    • ๐Ÿ›  Fix specs with side effects (#12539, thanks @straight-shoota)
    • ๐Ÿ›  Fix HTTP::Client implicit compression with retry (#12536, thanks @straight-shoota)
    • HTTP::StaticFileHandler: Reduce max stat calls from 6 to 2 (#12310, thanks @didactic-drunk)
    • โž• Add warning about concurrent requests in HTTP::Client (#12527, thanks @straight-shoota)

    Numeric

    • โž• Add full integer support to sprintf and String#% (#10973, thanks @HertzDevil)
    • ๐Ÿ‘‰ Make Float#to_s ignore NaN sign bit (#12399, thanks @HertzDevil)
    • ๐Ÿ–จ Make sprintf and String#% ignore NaN sign bit (#12400, thanks @HertzDevil)
    • ๐Ÿ›  Fix Complex#to_s imaginary component sign for certain values (#12244, thanks @HertzDevil)
    • More accurate definition of Complex#sign (#12242, thanks @HertzDevil)
    • ๐Ÿ›  Fix overflow for rand(Range(Int, Int)) when signed span is too large (#12545, thanks @HertzDevil)
    • ๐ŸŽ (performance) Add #rotate_left and #rotate_right for primitive integers (#12307, thanks @HertzDevil)
    • ๐ŸŽ (performance) Optimize BigDecimal#div for inexact divisions (#10803, thanks @HertzDevil)
    • Implement the Dragonbox algorithm for Float#to_s (#10913, thanks @HertzDevil)
    • โž• Add U/Int128 to isqrt spec (#11976, thanks @BlobCodes)

    โš™ Runtime

    • ๐Ÿ›  Fix: Parse DWARF5 Data16 values (#12497, thanks @stakach)
    • ๐ŸŽ macOS: Fix call stack when executable path contains symlinks (#12504, thanks @HertzDevil)
    • WASM: Add support for wasi-sdk 16: don't rely on __original_main (#12450, thanks @lbguilherme)

    Serialization

    • ๐Ÿ›  Fix YAML serialization class name ambiguity (#12537, thanks @hugopl)
    • ๐Ÿ‘ Allow non-type converter instances in ArrayConverter and HashValueConverter (#10638, thanks @HertzDevil)
    • ๐Ÿ”Š Document after_initialize method for yaml and json serializers (#12530, thanks @analogsalad)

    System

    • โž• Add missing fields to LibC::Passwd on FreeBSD (#12315, thanks @dmgk)
    • โž• Add platform-specific variants of Process.parse_arguments (#12278, thanks @HertzDevil)
    • ๐Ÿ‘‰ Make Dir.current respect $PWD (#12471, thanks @straight-shoota)

    Text

    • ๐Ÿ›  Fix String shift state specs on FreeBSD (#12339, thanks @dmgk)
    • ๐Ÿ–จ Disallow mixing of sequential and named sprintf parameters (#12402, thanks @HertzDevil)
    • ๐Ÿ›  Fix Colorize doc example (#12492, thanks @zw963)
    • ๐ŸŽ (performance) Optimize String#downcase and String#upcase for single byte optimizable case (#12389, thanks @asterite)
    • ๐ŸŽ (performance) Optimize String#valid_encoding? (#12145, thanks @HertzDevil)
    • Implement String#unicode_normalize and String#unicode_normalized? (#11226, thanks @HertzDevil)
    • ๐Ÿ‘Œ Support parameter numbers in sprintf (#12448, thanks @HertzDevil)
    • ๐Ÿ‘‰ Use LibC.malloc instead of GC.malloc for LibPCRE allocations (#12456, thanks @lbguilherme)
    • โšก๏ธ Unicode: Update to version 15.0.0 (#12479, thanks @HertzDevil)
    • ๐Ÿ†“ Avoid free call in interpreted mode (#12496, thanks @straight-shoota)

    Compiler

    • ๐Ÿ‘Œ Improve recursive splat expansion detection (#11790, thanks @asterite)
    • Compiler: fix #to_s for empty parameters of lib funs (#12368, thanks @HertzDevil)
    • Compiler: transform Proc(*T, Void) to Proc(*T, Nil) (#12388, thanks @asterite)
    • Compiler: indent begin Expressions that are direct node children (#12362, thanks @HertzDevil)
    • Compiler: add missing location to node on literal expander for array (#12403, thanks @asterite)
    • Compiler: a generic class type can also be reference-like (#12347, thanks @asterite)
    • Hoist complex element expressions outside container literals (#12366, thanks @HertzDevil)
    • ๐ŸŽ (performance) Compiler: bind to tuple, not array (#12423, thanks @asterite)
    • ๐Ÿ‘‰ Use Path.new(string) instead of Path.new([string]) (#12419, thanks @asterite)
    • โš  Decouple warning detection from program instances (#12293, thanks @HertzDevil)
    • ๐ŸŽ (performance) Compiler: only have freeze_type in select AST nodes (#12428, thanks @asterite)
    • Correctly display codegen when cross-compiling (#12414, thanks @luislavena)
    • Compiler: simplify some calls (#12417, thanks @asterite)
    • ๐ŸŽ (performance) Compiler: optimizations in merge_if_vars (#12432, #12433, thanks @asterite)
    • Compiler refactor: extract type_from_dependencies (#12437, thanks @asterite)
    • ๐ŸŽ (performance) Compiler: refactor and slightly optimize merging two types (#12436, thanks @asterite)
    • ๐ŸŽ (performance) Compiler optimization: don't create call for hook unless needed (#12452, thanks @asterite)
    • ๐ŸŽ (performance) CrystalPath: Cache Dir.current to avoid thousands of allocations (#12455, thanks @yxhuvud)
    • ๐Ÿ‘ Better call error messages (#12469, thanks @asterite)
    • ๐ŸŽ (performance) Compiler optimization: avoid intermediate array when matching call arg types (#12485, thanks @asterite)

    Codegen

    • Codegen: fix how unions are represented to not miss bytes (#12551, thanks @asterite)
    • ๐Ÿ›  Fix alignment typo in compiler comments (#12564, thanks @mdwagner)
    • โœ‚ Remove redundant code from x86_64 abi (#12443, thanks @mattrberry)
    • Codegen: use var pointer for out instead of an extra variable (#10952, thanks @asterite)

    Debugger

    • ๐Ÿ‘ Basic GDB formatter support (#12209, thanks @HertzDevil)
    • โž• Add Visual Studio formatters for String, Array, and Hash (#12212, thanks @HertzDevil)

    Interpreter

    • Interpreter: handle the case of a def's body with no type (#12220, thanks @asterite)
    • Interpreter: simplify ivar initialization (#12222, thanks @asterite)
    • Interpreter: fix autocasting in multidispatch (#12223, thanks @asterite)
    • Interpreter: handle next inside captured block (#12237, thanks @asterite)
    • Interpreter: fix crystal_type_id for virtual metaclass type (#12246, thanks @asterite)
    • Interpreter: handle yield with splat combined with tuple unpacking (#12247, thanks @asterite)
    • Interpreter: handle inlined call that returns self for structs (#12259, thanks @asterite)
    • Interpreter: implement Int128/UInt128 intrinsics (#12258, thanks @asterite)
    • Interpreter: fix some conversion primitives (#12257, thanks @asterite)
    • Interpreter: don't override special vars inside block (#12251, thanks @asterite)
    • Interpreter: add missing cast from tuple to other tuple inside union (#12249, thanks @asterite)
    • Interpreter: allow declaring local vars during a pry session (#12180, thanks @asterite)
    • Interpreter: handle bitreverse intrinsics (#12273, thanks @asterite)
    • Interpreter: cache methods with captured block (#12285, thanks @asterite)
    • Interpreter: missing downcast from MixedUnionType to NilableProcType (#12286, thanks @asterite)
    • Interpreter: fix with ... yield with extra arguments (#12301, thanks @asterite)
    • Interpreter: consider nodes without a type as NoReturn (#12275, thanks @asterite)
    • Interpreter: take with ... yield scope into account for args bytesize (#12317, thanks @asterite)
    • ๐Ÿ›  Fix loader spec on FreeBSD (#12323, thanks @dmgk)
    • Interpreter: inline ivar access for virtual call with a single child (#12321, thanks @asterite)
    • Interpreter: fix as? when there's no resulting type (#12328, thanks @asterite)
    • Interpreter: handle missing closured struct self (#12345, thanks @asterite)
    • Interpreter: use non_nilable_type in NilableCast (#12348, thanks @asterite)
    • Interpreter: implement mixed union cast with compatible tuple types (#12349, thanks @asterite)
    • Interpreter: fix missing upcast_distinct from A+ to B (Crystal::VirtualType to Crystal::NonGenericClassType) (#12374, thanks @asterite)
    • Interpreter: discard tuple and named tuple (#12387, thanks @asterite)
    • Interpreter: cast proc call arguments to proc arg types (#12375, thanks @asterite)
    • Interpreter: set correct scope for class var initializer (#12441, thanks @asterite)
    • Interpreter (repl): use new MainVisitor each time we need to interpret code (#12512, thanks @asterite)
    • Interpreter: allow inspecting block vars without affecting program (#12520, thanks @asterite)
    • Interpreter: check upcast in nilable cast (#12533, thanks @asterite)
    • Interpreter: implement variable autocast (#12563, thanks @asterite)
    • Interpreter: handle missing upcast from GenericClassInstanceMetaclassType to VirtualMetaclassType (#12562, thanks @asterite)
    • ๐Ÿ‘€ Interpreter: let local vars be seen by macros in repl and pry (#12240, thanks @asterite)
    • Interpreter: handle local variable type declaration (#12239, thanks @asterite)
    • ๐Ÿ‘Œ Support libffi on Windows (#12200, thanks @HertzDevil)
    • Add $CRYSTAL_INTERPRETER_LOADER_INFO to show loaded libraries (#12221, thanks @straight-shoota)
    • Interpreter: node override (#12287, thanks @asterite)
    • Interpreter: introduce a Prompt type (#12288, thanks @asterite)
    • Interpreter: missing i += 1 (#12381, thanks @asterite)
    • ๐Ÿ‘Œ Support building the interpreter on Windows (#12397, thanks @HertzDevil)
    • Don't exit in interpreter spec and change type from Nil to NoReturn in FixMissingTypes (#12230, thanks @asterite)
    • Interpreter: fix multidispatch with captured block (#12236, thanks @asterite)
    • Interpreter: don't change compiled mode logic (#12252, thanks @asterite)
    • Wait more in HTTP::Server specs in interpreted mode (#12420, thanks @asterite)

    ๐Ÿ“œ Parser

    • Lexer: fix index out of bounds when scanning numbers (#12482, thanks @asterite)
    • ๐Ÿ›  Fix parser to never create doc from trailing comment (#11268, thanks @straight-shoota)
    • ๐Ÿ“œ Parser: declare local vars of indirect type declarations in call args (#11983, thanks @asterite)
    • โœ‚ Remove redundant conditional (#12196, thanks @potomak)
    • Warn on suffix-less integer literals outside Int64's range (#12427, thanks @HertzDevil)
    • ๐Ÿ‘‰ Use enum instead of symbols for keywords in the lexer (#11871, thanks @HertzDevil)
    • Parser: Rename arg* to param* (#12235, thanks @potomak)
    • ๐Ÿ›  Fix test cases (#12508, thanks @potomak)

    Semantic

    • (breaking-change) Allow Union restrictions to be ordered before all other restrictions (#12335, thanks @HertzDevil)
    • (breaking-change) Use more robust ordering between def overloads (#10711, thanks @HertzDevil)
    • ๐Ÿ›  Fix: Instance vars should not be allowed on Class, Tuple, NamedTuple, Enum, Pointer , Proc, StaticArray and Union. (#12160, thanks @I3oris)
    • Compiler and interpreter: fix is_a? from virtual metaclass to generic metaclass (#12306, thanks @asterite)
    • Compiler: fix type descendent for union metaclass (#12308, thanks @asterite)
    • Compiler: fix is_a? from generic class against generic class instance type (#12312, thanks @asterite)
    • ๐Ÿ›  Fix self in restrictions when instantiating macro def in subtypes (#10954, thanks @HertzDevil)
    • ๐Ÿ†“ Never resolve free variables as types during overload ordering (#11973, thanks @HertzDevil)
    • ๐Ÿ‘‰ Use instantiated type as self when inferring instance variable types (#12466, thanks @HertzDevil)
    • ๐Ÿ›  Fix restriction comparison between Metaclass and Path (#12523, thanks @HertzDevil)
    • ๐ŸŽ (performance) Compiler: don't always use Array for node dependencies and observers (#12405, thanks @asterite)
    • ๐Ÿ‘ Compiler: better error message for symbol against enum (#12478, thanks @asterite)

    Tools

    ๐Ÿ“„ Docs-generator

    • ๐Ÿ›  Fix docs generator search constants id (#12262, thanks @GeopJr)

    Formatter

    • Formatter: format comment after select (#12506, thanks @asterite)
    • Formatter: try to format macros that don't interpolate content (#12378, thanks @asterite)

    Playground

    • Playground: Fix pass bound hostname to run sessions (#12356, thanks @orangeSi)
    • Don't show stacktrace when playground port is already in use. (#11844, thanks @hugopl)
    • Indent playground code using spaces (#12231, thanks @potomak)

    Other

    • bin/crystal: Ensure sh compatibility (#12486, thanks @HertzDevil)
    • โฌ†๏ธ bumping version 1.6.0-dev (#12263, thanks @beta-ziliani)
    • โšก๏ธ updating CI to 1.5.0 (#12260, thanks @beta-ziliani)
    • โž• Add fish shell completion (#12026, thanks @TunkShif)
    • Execute compopt only when it's present (#12248, thanks @potomak)
    • ๐Ÿ Use Makefile.win and wrapper script on Windows CI (#12344, thanks @HertzDevil)
    • [Makefile] Add format target (#11420, thanks @straight-shoota)
    • โšก๏ธ Update contact section of CODE of CONDUCT (#9219, thanks @paulcsmith)
    • โšก๏ธ Update nixpkgs 22.05 and LLVM 11 (#12498, thanks @straight-shoota)
    • [Makefile] Use EXPORT_CC for make crystal (#11760, thanks @straight-shoota)
    • โšก๏ธ Update distribution-scripts (#12502, #12555, thanks @straight-shoota)
    • ๐Ÿ›  Fix and enhance scripts/update-distribution-scripts.sh (#12503, thanks @straight-shoota)
    • โฌ†๏ธ [CI] Upgrade GitHub Actions to macos-11 (#12500, thanks @straight-shoota)
    • โž• Add icon and metadata to Windows Crystal compiler binary (#12494, thanks @HertzDevil)
    • Remove spec/win32_std_spec.cr and spec/generate_windows_spec.sh (#12282, #12549, thanks @HertzDevil and @straight-shoota)