Skip to content

Tiny v0.2.8 - Implicit Null Initialization and LSP Overhaul

Choose a tag to compare

@confh confh released this 22 Jun 12:44

This release adds implicit null initialization for variables and fields, restricts imports to exported symbols only, and rewrites the LSP's symbol analysis to use AST-based indexing instead of regex scanning.

Language Changes

  • Implicit Null Initialization: Variables and fields can now be declared without an initializer. let x; is equivalent to let x = null;. Class fields follow the same rule, except const fields which still require an explicit initializer.
  • Function Stub Declarations: Functions can now have their bodies omitted with a semicolon, allowing forward-declaration style stubs.
  • Multiple Defer Statements: The restriction on a single defer per function scope has been removed. Multiple defer statements are now allowed.
  • Enum Match Safety: Pattern matching on enums now validates that the value is an object before inspecting enum tags, preventing incorrect matches on non-object values.

Compiler Changes

  • Semantic Error Pre-check: The compiler now runs semantic analysis before bytecode generation. Errors such as undefined variables and type mismatches are caught and reported upfront instead of silently producing broken bytecode.
  • Target Normalization from Config: The pack and dist commands now read the target field from tiny.json and normalize it correctly. Previously, the config target was sometimes ignored when a CLI target was not provided.

LSP Changes

  • AST-Based Symbol Indexing: The language server now builds its symbol index directly from the parsed AST when available, replacing the previous regex-based line scanning. This improves accuracy for nested classes, enums, interfaces, namespaces, and destructured variables.
  • Private Import Filtering: Symbols not exported from imported files are now hidden from completions, hover, signature help, and document symbols. This prevents internal implementation details from leaking into the editor.
  • Type Reference Tracking: Symbols now carry structured TypeRef information instead of plain strings, improving type display in inlay hints and completion items. Class, interface, and enum prefixes are stripped from inlay hint labels.
  • Return Type Inference: Function return types are now inferred from the function body when not explicitly annotated, using analysis of all return statements.
  • Enum Member Positions: Enum member symbols now track their actual line and column positions from the source text rather than defaulting to the enum declaration line.
  • Union Type Callback Resolution: Callback parameter type resolution now correctly handles union types, extracting function signatures from individual union members.

Standard Library Stubs

  • All standard library stubs have been updated to remove empty function bodies {} from declarations. Method signatures now end at the return type, matching the new parser support for stub declarations.
  • HTTP server route handlers now specify their callback parameter types (e.g., function(RequestObject) instead of plain function).

Error Formatting

  • Compiler and runtime errors are now colorized. File paths, line numbers, column numbers, error kinds, and stack traces are each styled with distinct colors for easier readability.
  • Stack trace frames show function names in a distinct color with file and line information highlighted.

Installation and Downloads

To install Tiny, download the compiler binary for your specific operating system:

  • Windows: Download tiny_windows_amd64.exe
  • Linux: Download tiny_linux_amd64 for amd64 or tiny_linux_arm64 for arm64
  • macOS (Apple Silicon): Download tiny_darwin_arm64

Note: The tiny_runtime_* assets listed in the releases page are managed automatically by the compiler during the pack and dist commands. You do not need to download them manually.