kaleidawave / ezno

A JavaScript compiler and TypeScript checker written in Rust with a focus on static analysis and runtime performance
https://kaleidawave.github.io/posts/introducing-ezno/
MIT License
2.3k stars 42 forks source link

Internal improvements to subtyping and substitution #146

Closed kaleidawave closed 1 month ago

kaleidawave commented 1 month ago
kaleidawave commented 1 month ago

Wondering whether to make events flatten and reuse them more (instead of state and ApplicationResult which sorts of duplicates information).

Also on the topic of events: should have an option to record all set and variable events for usage in extra diagnostics

kaleidawave commented 1 month ago

image

Still to do

Done

kaleidawave commented 1 month ago

For mapped types: could

  1. Type arguments to enum TypeArgument = Explicit | PropertyKey | ...
  2. Specialisation arguments have a property key field which is can use to specialise a mapped type?

However 2 is a little cheaty 1 is a workaround for the fact that can't create types without &mut TypeStore. PropertyKey wouldn't have a problem if TypeId could reference a string (possibly interned). So maybe better to pause for when I attempt #120

kaleidawave commented 1 month ago

Managed to squeeze some new features in here, bringing the passing tests to 235!

kaleidawave commented 1 month ago

This is weird. But we move

error: 
    ┌─ demo.ts:414:7
    │
410 │     function getA<T extends { a: strinthread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/source-map-0.15.0/src/filesystem.rs:141:24:
index out of bounds: the len is 2 but the index is 18446744073709551615
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
g }>(p: T) {
    │                                            ---- Parameter has type T
    ·
414 │     getA({ a: 2 })
    │