Skip to content

Commit dab8faf

Browse files
authored
Fixes around disjoint implementation (#209)
- Change over intersection to use disjoint function - Change ranges back to LessThan & GreaterThan - Narrowing fix - Add modulo_class and float_range helpers - Extract helpers and operator modules - Literal on object - Indentation in specification - Disjoint on template literals - Move specification tests
1 parent bba226c commit dab8faf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3888
-2434
lines changed

.github/workflows/clippy-rustfmt-fix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19+
- uses: dtolnay/rust-toolchain@stable
1920
- uses: actions/cache@v4
2021
with:
2122
path: ${{ env.CACHE_PATHS }}

.github/workflows/performance-and-size.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,15 @@ jobs:
3737
env:
3838
CARGO_PROFILE_RELEASE_DEBUG: true
3939

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

4850
- name: Set compilers
4951
id: compilers
@@ -197,16 +199,16 @@ jobs:
197199
curl -sS $url > input.js
198200
199201
echo "::group::Comparison"
200-
hyperfine \
202+
hyperfine -i \
201203
-L compiler ${{ steps.compilers.outputs.BINARIES }} \
202204
'{compiler} ast-explorer full input.js --timings'
203205
echo "::endgroup::"
204206
done
205207
206-
- name: Upload checker
207-
if: github.ref == 'main'
208-
uses: actions/upload-artifact@v4
209-
with:
210-
name: latest-checker
211-
path: target/release/ezno
212-
retention-days: 90
208+
# - name: Upload checker
209+
# if: github.ref == 'main'
210+
# uses: actions/upload-artifact@v4
211+
# with:
212+
# name: latest-checker
213+
# path: target/release/ezno
214+
# retention-days: 90

.github/workflows/rust.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595

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

100100
- name: Run checker specification (w/ staging)
101101
if: steps.changes.outputs.checker == 'true' && github.event_name == 'pull_request'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ What Ezno is:
1818

1919
What Ezno is not
2020
- **eNZo, the Z is in front of the N** (pronounce as 'Fresno' without the 'fr') 😀
21-
- Be on parity with TSC or 1:1, it has some different behaviors **but** should work in existing projects using TSC
21+
- 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)
2222
- Faster as a means to serve large codebases. Cut out bloat and complex code first!
2323
- Smarter as a means to allow more *dynamic patterns*. Keep things simple!
2424
- 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.

checker/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ path-absolutize = { version = "3.0", features = ["use_unix_paths_on_wasm"] }
3939
either = "1.6"
4040
levenshtein = "1"
4141
ordered-float = "4.2"
42-
regress = { version = "0.10.0", features = [] }
42+
regress = { version = "0.10", features = [] }
4343

4444
serde = { version = "1.0", features = ["derive"], optional = true }
4545
simple-json-parser = "0.0.2"
-666 Bytes
Binary file not shown.

checker/definitions/overrides.d.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare class Array<T> {
3737

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

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

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

130-
type LessThan<T extends number> = ExclusiveRange<NegativeInfinity, T>;
131-
type GreaterThan<T extends number> = ExclusiveRange<T, Infinity>;
130+
type ExclusiveRange<F extends number, C extends number> = GreaterThan<F> & LessThan<C>;
131+
type InclusiveRange<F extends number, C extends number> = (GreaterThan<F> & LessThan<C>) | (F | C);
132+
132133
type Integer = MultipleOf<1>;
133134

134135
declare class Map<T, U> {
@@ -202,7 +203,7 @@ declare class Promise<T> { }
202203

203204
declare class RegExp {
204205
@Constant("regexp:constructor")
205-
constructor(pattern: string, flags?: string);
206+
constructor(pattern: string, flags?: string);
206207

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

227-
// es2018
228-
interface RegExpExecArray {
228+
// // es2018
229+
// interface RegExpExecArray {
229230
groups?: {
230231
[key: string]: string;
231232
};

checker/definitions/simple.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,9 @@ declare class Map<K, V> {
211211

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

214-
type LessThan<T extends number> = ExclusiveRange<NegativeInfinity, T>;
215-
type GreaterThan<T extends number> = ExclusiveRange<T, Infinity>;
214+
type ExclusiveRange<F extends number, C extends Number> = GreaterThan<F> & LessThan<C>;
215+
type InclusiveRange<F extends number, C extends Number> = (GreaterThan<F> & LessThan<C>) | (F | C);
216+
216217
type Integer = MultipleOf<1>;
217218

218219
/**

checker/examples/run_checker.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ fn main() {
2020
let no_lib = args.iter().any(|item| item == "--no-lib");
2121
let debug_dts = args.iter().any(|item| item == "--debug-dts");
2222
let extras = args.iter().any(|item| item == "--extras");
23+
let advanced_numbers = args.iter().any(|item| item == "--advanced-numbers");
2324

2425
let now = Instant::now();
2526

@@ -46,6 +47,7 @@ fn main() {
4647
max_inline_count: 600,
4748
debug_dts,
4849
extra_syntax: extras,
50+
advanced_numbers,
4951
..Default::default()
5052
};
5153

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

6163
if args.iter().any(|arg| arg == "--types") {
6264
eprintln!("Types:");
63-
let types = result.types.into_vec_temp();
64-
for (type_id, item) in &types[types.len().saturating_sub(60)..] {
65+
for (type_id, item) in result.types.user_types() {
6566
eprintln!("\t{type_id:?}: {item:?}");
6667
}
6768
}
@@ -74,6 +75,10 @@ fn main() {
7475
}
7576
}
7677

78+
if args.iter().any(|arg| arg == "--called-functions") {
79+
eprintln!("Called function: {:?}", result.types.called_functions);
80+
}
81+
7782
if args.iter().any(|arg| arg == "--time") {
7883
let end = now.elapsed();
7984
let count = result.diagnostics.into_iter().len();

checker/specification/Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ publish = false
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[features]
10-
just-staging = []
10+
default = ["base"]
11+
base = []
1112
staging = []
12-
all = ["staging"]
13+
to_implement = []
14+
all = ["base", "staging", "to_implement"]
1315

1416
[[test]]
1517
name = "specification_test"

0 commit comments

Comments
 (0)