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

Object destructuring, this unbinding and checking #127

Merged
merged 27 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a63bcc0
Class hoisting and use as internal. Package imports and more
kaleidawave Mar 15, 2024
b6e9b80
Generic chain and others generic fixes
kaleidawave Mar 20, 2024
a891b69
Closure & variable declaration fixes
kaleidawave Mar 20, 2024
a344750
Working commit of complete object destructuring
lemueldls Mar 26, 2024
3368c44
Template assignable array destructuring
lemueldls Mar 26, 2024
1dfbe55
Hoist and compartmentalize env functions
lemueldls Mar 26, 2024
89150ac
Not bind `this` value when destructuring
lemueldls Mar 27, 2024
7d52ef5
Optimize synthesise to reference
lemueldls Mar 27, 2024
be38fe2
Cleanup comments
lemueldls Mar 27, 2024
22ce7a9
Generalize `synthesise_expression` lifetime
lemueldls Mar 27, 2024
d1499e9
Fix mismatched 'this' context error
lemueldls Mar 29, 2024
9b47a72
Fix definition by explicitly defining `this`
lemueldls Mar 29, 2024
559bedb
Explicitly define `this` parameter of all array methods
lemueldls Mar 30, 2024
3790fb6
Stage new specification tests
lemueldls Mar 30, 2024
d897f6a
Fix specification tests
lemueldls Mar 30, 2024
de80d9d
Partial checking of values compared with classes
lemueldls Apr 3, 2024
34fa8ac
Include class with generics in type checking
lemueldls Apr 3, 2024
a41e254
Merge remote-tracking branch 'upstream/checker-improvements-153' into…
lemueldls Apr 8, 2024
16b34b1
Merge remote-tracking branch 'upstream/main' into object-destructuring
lemueldls Apr 8, 2024
7349827
Add and fix some new specification tests
lemueldls Apr 8, 2024
06bf170
Temporary solution for nominal types to fix tests
lemueldls Apr 8, 2024
566fe40
Implement checks using getter properties
lemueldls Apr 8, 2024
485e27b
Fix checker without default features
lemueldls Apr 9, 2024
45e88dd
Appease clippy
lemueldls Apr 9, 2024
976a54b
Fix infinite recursion when getting facts of constants
lemueldls Apr 9, 2024
5ff272b
Specification test 200
lemueldls Apr 9, 2024
e7f933d
Fix specification with correct test
lemueldls Apr 9, 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
Binary file modified checker/definitions/internal.ts.d.bin
Binary file not shown.
2 changes: 1 addition & 1 deletion checker/definitions/overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,4 @@ declare function satisfies<T>(t: T): T;

@Constant
declare function compile_type_to_object<T>(): any;
// ↑↑ Ezno Functions ↑↑
// ↑↑ Ezno Functions ↑↑
50 changes: 48 additions & 2 deletions checker/specification/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,16 @@ callToUpperCase("hi") satisfies "HEY";

- Expected "HEY", found "HI"

#### String internal `this` unbinding error

```ts
const { toUpperCase } = "hi";

toUpperCase();
```

- The 'this' context of the function is expected to be string, found undefined

#### Calling new on a function

```ts
Expand Down Expand Up @@ -739,7 +749,7 @@ doThing(6, 1) satisfies 6;
let a: number = 0
function func() {
a = 4;
// Important that subsequent reads use the
// Important that subsequent reads use the
// new value, not the same free variable
a satisfies 4;
}
Expand Down Expand Up @@ -1569,7 +1579,7 @@ interface X {
interface X {
c: number
}

const x: X = { a: "field", b: false, c: false }
const y: X = { a: "field", b: false, c: 2 }
}
Expand Down Expand Up @@ -1658,6 +1668,27 @@ try {

- Expected string, found 3

#### Object destructuring assignment

```ts
const o = { a: 1, b: { c: 3 } };

let a, b, c;
({
c = o.a++,
b: { c: b = 7 },
a,
} = o);

a satisfies string;
b satisfies boolean;
c satisfies 3;
```

- Expected string, found 2
- Expected boolean, found 3
- Expected 3, found 1

### Async and `Promise`s

> Position of await is not checked (here is fine because top level await)
Expand Down Expand Up @@ -1692,6 +1723,21 @@ x.value satisfies string

- Expected string, found 4

#### Class `this` unbinding

```ts
class X {
method() {
return this;
}
}

const { method } = new X();
method();
```

- The 'this' context of the function is expected to be X, found undefined

#### Property keys

> Property keys are synthesised once and their effects run once (as opposed to their value)
Expand Down
Loading