Skip to content

Tiny v0.2.6 - Destructuring, Sum Types, and LSP Enhancements

Choose a tag to compare

@confh confh released this 16 Jun 23:24

Tiny v0.2.6 - Destructuring, Sum Types, and LSP Enhancements

This release introduces major language features including object and array destructuring, data-carrying enum variants, and significant improvements to the built-in Language Server (LSP).

Language Features

  • Destructuring Assignment: Support for object and array destructuring in let and const statements. Includes support for nested patterns, property renaming, and spread elements.
  • Enum Variants with Data: Enums now support variants with associated data, enabling the use of Sum Types (Algebraic Data Types).
  • Advanced Pattern Matching: The match statement now supports union patterns (A | B), guard patterns (if conditions), and binding patterns for extracting enum variant payloads.
  • Bitwise Operators: Added support for bitwise operators: AND (&), OR (|), XOR (^), NOT (~), and bitwise shifts (<<, >>). Corresponding assignment operators (&=, |=, etc.) are also supported.
  • Nullable Type Shorthand: Added the ? suffix as a shorthand for nullable types (e.g., string? is equivalent to string | null).
  • Function Type Hints: Support for detailed function type signatures in hints, such as function(number, string): bool.
  • Numeric Separators: Numbers can now include underscores for better readability (e.g., 1_000_000).

Language Server (LSP) Enhancements

  • Semantic Tokens: Full semantic highlighting for keywords, types, classes, enums, functions, and variables.
  • Inlay Hints: Added callback parameter type hints. The LSP now infers and displays parameter types for anonymous functions used as callbacks.
  • Document Highlights: Highlighting of all references to the symbol currently under the cursor.
  • Improved Type Narrowing: Enhanced flow analysis for typeof and instanceof guards, providing better autocompletion within conditional blocks.
  • Native Block Isolation: The analyzer and formatter now correctly handle go { ... } blocks inside native functions, preventing false syntax errors.

VM and JIT Optimizations

  • Wasm Object Array Packing: Optimized access to homogeneous object arrays by mirroring them in Wasm linear memory. JIT code now accesses properties via direct offsets.
  • JIT String Join: Enabled JIT acceleration for string joining operations.
  • Dynamic Memory Growth: JIT object allocation now utilizes a host import that handles Wasm memory growth safely.
  • Native Timers: Added support for time.timeout(ms, callback) and time.interval(ms, callback), returning manageable Timer objects.
  • Advanced Array Methods: Added native implementations for reduce, sort, slice, flat, flatMap, and findIndex.

Bug Fixes

  • Fixed signed integer to string conversion for negative numbers and minimum values.
  • Improved LSP organize imports logic to preserve formatting around native Go blocks.