Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for disjoint stuff #209

Merged
merged 25 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a2966e3
Fixes for disjoint stuff
kaleidawave Sep 29, 2024
b4313fd
More fixes to Not type and narrowing
kaleidawave Oct 5, 2024
e0aa234
Improvements to benchmarking (inc some parser fixes)
kaleidawave Oct 5, 2024
1b04c6c
Update for regress
kaleidawave Oct 5, 2024
6d3f8f2
Formatting in example
kaleidawave Oct 5, 2024
6f96aee
Update deps + fix for regexp
kaleidawave Oct 5, 2024
4192660
Change ranges back to LessThan & GreaterThan
kaleidawave Oct 5, 2024
de9113a
Fix for tree shaking of known functions inside of callbacks
kaleidawave Oct 21, 2024
b78844c
Update CI tasks
kaleidawave Oct 21, 2024
c936ef1
Clippy and cargo fmt fixes inline with latest Rust
kaleidawave Oct 21, 2024
d9349ff
Checker changes
kaleidawave Oct 26, 2024
925cec9
CLI changes
kaleidawave Oct 26, 2024
29de885
Add modulo class + 1/2 way through improving things
kaleidawave Nov 7, 2024
e5ac069
Undo some CLI Stuff
kaleidawave Nov 8, 2024
4d33090
WIP Improvements
kaleidawave Nov 8, 2024
5215906
More checker improvements
kaleidawave Nov 10, 2024
8530950
Improve specification tests and parser parsing examples
kaleidawave Nov 10, 2024
6e93bd9
Fix for #207
kaleidawave Nov 12, 2024
a64bb45
More improvements
kaleidawave Nov 13, 2024
61c2922
Merge branch 'main' into improve-generics-and-fixes
kaleidawave Nov 13, 2024
ebae1bb
Some more fixes
kaleidawave Nov 13, 2024
8066d22
Fixes for clippy & code in unit test
kaleidawave Nov 13, 2024
956940a
Fixes
kaleidawave Nov 13, 2024
70433c3
Fixes to workflows
kaleidawave Nov 13, 2024
98872dd
Last minute fix for playground
kaleidawave Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/clippy-rustfmt-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: ${{ env.CACHE_PATHS }}
Expand Down
32 changes: 17 additions & 15 deletions .github/workflows/performance-and-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,15 @@ jobs:
env:
CARGO_PROFILE_RELEASE_DEBUG: true

- name: Get base ezno
if: github.ref_name != 'main'
uses: actions/download-artifact@v4
continue-on-error: true
with:
name: latest-checker
path: previous-ezno
# TODO need to lookup existing workflow on main
# even if this worked, it might have issues with newer features added in this run
# - name: Get base ezno
# if: github.ref_name != 'main'
# uses: actions/download-artifact@v4
# continue-on-error: true
# with:
# name: latest-checker
# path: previous-ezno

- name: Set compilers
id: compilers
Expand Down Expand Up @@ -197,16 +199,16 @@ jobs:
curl -sS $url > input.js

echo "::group::Comparison"
hyperfine \
hyperfine -i \
-L compiler ${{ steps.compilers.outputs.BINARIES }} \
'{compiler} ast-explorer full input.js --timings'
echo "::endgroup::"
done

- name: Upload checker
if: github.ref == 'main'
uses: actions/upload-artifact@v4
with:
name: latest-checker
path: target/release/ezno
retention-days: 90
# - name: Upload checker
# if: github.ref == 'main'
# uses: actions/upload-artifact@v4
# with:
# name: latest-checker
# path: target/release/ezno
# retention-days: 90
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:

- name: Run checker specification
if: (steps.changes.outputs.checker == 'true' && github.event_name != 'pull_request') || github.ref_name == 'main'
run: cargo test
run: cargo test -p ezno-checker-specification

- name: Run checker specification (w/ staging)
if: steps.changes.outputs.checker == 'true' && github.event_name == 'pull_request'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ What Ezno is:

What Ezno is not
- **eNZo, the Z is in front of the N** (pronounce as 'Fresno' without the 'fr') 😀
- Be on parity with TSC or 1:1, it has some different behaviors **but** should work in existing projects using TSC
- Be on parity with TSC or 1:1, it has some different behaviors **but** should work in existing projects using TSC. [You can see a full comparison of emitted errors and warnings compared with TSC here](https://kaleidawave.github.io/ezno/comparison)
- Faster as a means to serve large codebases. Cut out bloat and complex code first!
- Smarter as a means to allow more *dynamic patterns*. Keep things simple!
- A binary executable compiler. It takes in JavaScript (or a TypeScript or Ezno superset) and does similar processes to traditional compilers, but at the end emits JavaScript. However, in the future, it *could* generate a lower level format using its event (side-effect) representation.
Expand Down
2 changes: 1 addition & 1 deletion checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ path-absolutize = { version = "3.0", features = ["use_unix_paths_on_wasm"] }
either = "1.6"
levenshtein = "1"
ordered-float = "4.2"
regress = { version = "0.10.0", features = [] }
regress = { version = "0.10", features = [] }

serde = { version = "1.0", features = ["derive"], optional = true }
simple-json-parser = "0.0.2"
Expand Down
Binary file modified checker/definitions/internal.ts.d.bin
Binary file not shown.
17 changes: 9 additions & 8 deletions checker/definitions/overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare class Array<T> {

// TODO this argument
map<U>(cb: (t: T, i?: number) => U): Array<U> {
const { length } = this, mapped: Array<U> = [];
const { length } = this, mapped: U[] = [];
let i: number = 0;
while (i < length) {
const value = this[i];
Expand All @@ -48,7 +48,7 @@ declare class Array<T> {

// // TODO any is debatable
filter(cb: (t: T, i?: number) => any): Array<T> {
const { length } = this, filtered: Array<T> = [];
const { length } = this, filtered: T[] = [];
let i: number = 0;
while (i < length) {
const value = this[i];
Expand Down Expand Up @@ -127,8 +127,9 @@ declare class Array<T> {

type Record<K extends string, T> = { [P in K]: T }

type LessThan<T extends number> = ExclusiveRange<NegativeInfinity, T>;
type GreaterThan<T extends number> = ExclusiveRange<T, Infinity>;
type ExclusiveRange<F extends number, C extends number> = GreaterThan<F> & LessThan<C>;
type InclusiveRange<F extends number, C extends number> = (GreaterThan<F> & LessThan<C>) | (F | C);

type Integer = MultipleOf<1>;

declare class Map<T, U> {
Expand Down Expand Up @@ -202,7 +203,7 @@ declare class Promise<T> { }

declare class RegExp {
@Constant("regexp:constructor")
constructor(pattern: string, flags?: string);
constructor(pattern: string, flags?: string);

@Constant("regexp:exec")
exec(input: string): RegExpExecArray | null;
Expand All @@ -222,10 +223,10 @@ interface RegExpExecArray extends Array<string> {
* The first match. This will always be present because `null` will be returned if there are no matches.
*/
0: string;
}
// }

// es2018
interface RegExpExecArray {
// // es2018
// interface RegExpExecArray {
groups?: {
[key: string]: string;
};
Expand Down
5 changes: 3 additions & 2 deletions checker/definitions/simple.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,9 @@ declare class Map<K, V> {

type Record<K extends string, T> = { [P in K]: T }

type LessThan<T extends number> = ExclusiveRange<NegativeInfinity, T>;
type GreaterThan<T extends number> = ExclusiveRange<T, Infinity>;
type ExclusiveRange<F extends number, C extends Number> = GreaterThan<F> & LessThan<C>;
type InclusiveRange<F extends number, C extends Number> = (GreaterThan<F> & LessThan<C>) | (F | C);

type Integer = MultipleOf<1>;

/**
Expand Down
9 changes: 7 additions & 2 deletions checker/examples/run_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn main() {
let no_lib = args.iter().any(|item| item == "--no-lib");
let debug_dts = args.iter().any(|item| item == "--debug-dts");
let extras = args.iter().any(|item| item == "--extras");
let advanced_numbers = args.iter().any(|item| item == "--advanced-numbers");

let now = Instant::now();

Expand All @@ -46,6 +47,7 @@ fn main() {
max_inline_count: 600,
debug_dts,
extra_syntax: extras,
advanced_numbers,
..Default::default()
};

Expand All @@ -60,8 +62,7 @@ fn main() {

if args.iter().any(|arg| arg == "--types") {
eprintln!("Types:");
let types = result.types.into_vec_temp();
for (type_id, item) in &types[types.len().saturating_sub(60)..] {
for (type_id, item) in result.types.user_types() {
eprintln!("\t{type_id:?}: {item:?}");
}
}
Expand All @@ -74,6 +75,10 @@ fn main() {
}
}

if args.iter().any(|arg| arg == "--called-functions") {
eprintln!("Called function: {:?}", result.types.called_functions);
}

if args.iter().any(|arg| arg == "--time") {
let end = now.elapsed();
let count = result.diagnostics.into_iter().len();
Expand Down
6 changes: 4 additions & 2 deletions checker/specification/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
just-staging = []
default = ["base"]
base = []
staging = []
all = ["staging"]
to_implement = []
all = ["base", "staging", "to_implement"]

[[test]]
name = "specification_test"
Expand Down
4 changes: 2 additions & 2 deletions checker/specification/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let out_path = Path::new(&std::env::var("OUT_DIR")?).join("specification.rs");
let mut out = File::create(out_path)?;

if cfg!(not(feature = "just-staging")) {
if cfg!(feature = "base") {
let specification = read_to_string("./specification.md")?;
markdown_lines_append_test_to_rust(specification.lines().enumerate(), &mut out)?;
}
Expand All @@ -26,7 +26,7 @@ fn main() -> Result<(), Box<dyn Error>> {
writeln!(&mut out, "}}").unwrap();
}

if cfg!(feature = "all") {
if cfg!(feature = "to_implement") {
let to_implement = read_to_string("./to_implement.md")?;
writeln!(&mut out, "mod to_implement {{ ").unwrap();
writeln!(&mut out, "use super::{{check_expected_diagnostics, TypeCheckOptions}}; ")
Expand Down
Loading
Loading