-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Object destructuring, this unbinding and checking #127
Conversation
Whoa this is legendary. Not one but two issues! (also good idea to base it on my WIP branch) Bit busy to do a checkout and review line-by-line and test ATM. But had a quick look and splitting up the methods is a great idea! In terms of the object destructuring assignment that is great! Yes I think they are spreads and enumerability right? I know that I have the concept of a property being The array destructuring is the other one. I think a few a weeks I realised that it is not as simple as The The ezno/checker/definitions/full.d.ts Line 140 in a891b69
I can do that part if you want. But if you could get an function calling error raised for invalid Additionally you can add 3 new tests (object des assignment, class this, string/internal this error) for these additions (see #100). You can put them in |
Thanks! I should also mention one of the tests in #98 fail because
I got Explicitly defining I am not sure if Maybe const { f } = new (class {
f() {
return 42;
}
})();
print_type(f()); // should be `42`
// ^? error This example in particular fails only for classes, in this case, warn for non-static methods not using I'll push the commits right now, along with the specification tests. |
EDIT: Adding I could try to implicitly define |
Awesome this looks ready to merge! I am a bit busy ATM, so will sort next weekend :) Excited to include the |
Hey, just going to finish and merge somethings in #126. Then will update this PR to point at the main branch (that way should keep things tidy and retain committer information). Will fix any other issues and conflicts that come up, then merge this afternoon 🎉 |
Hey! A few last things that cause some test to fail (that are kind of their own issues):
|
Ah yes, good investigation! ezno/checker/src/types/functions.rs Lines 72 to 78 in 0fa4fa8
ezno/checker/src/types/functions.rs Line 134 in 0fa4fa8
and
Ahh I hadn't seen those new commits. One thing I was experimenting with a while ago was treating classes nominally (aka don't do property checking if they are on the LHS of subtype comparison, only look at constant base type and in some cases object prototypes). Should write up a issue around it (I know TS does allow structural checks when the a class is the LHS of subtyping, maybe there is a compromise where only Is there an example for adding structural subtyping for class checks? |
Looks like I got bit overconfident in my git ability. Changing the target branch has brought in three commits from #126. Trying to figure it out RN: https://stackoverflow.com/questions/78293184/changing-target-branch-on-github-pr-has-added-additional-commits?noredirect=1#comment138028245_78293184 I think you have to run In hindsight just merging into that other PR would have been a lot easier 😅 I have learned nothing from #44. |
Oh wow, these are a lot of merge conflicts... Are you sure you need to force push? I just ran |
I think your It is a shame there is no undo button here Alternatively I think I can fix it in another PR (#129) and just link back to this PR from there 🤷♂️ |
I pulled from
That's strange since I enabled contributor editing from the start. If that's causing issues I have some time now to try out fixing up some of the merge conflicts, since they look to be straight-forward to fix (I hope). And I don't even know how you did this so silently, was this a force push? |
Awesome, good luck with the conflicts 😀. I will have a look tomorrow at those commands. Just worried about putting a commit that says there a 5k lines of changes but they are already under main 🤨. I think it is because the force push is to your forked repo which I don't have write access to? Maybe not sure |
Also, what happened to |
Ok, done. |
During development while I am still working on a PR I like to separate the new features tests from the existing tests as it helps to isolate regressions. Once it is finished and I know they all work I merge them into the complete specification.md. Once you know your new ones have passed, just before this is ready to merge you can put them into specification.md. |
All specification tests are passing now (through temporary exceptions). I could probably fix the CI job, Check checker without default features tomorrow night, since I think it'll involve changing a lot of function to use some |
Awesome! Wow that's good that the conflicts have solved and the change count has come back down, I didn't think that was possible. Yes the only place where ezno-parser can be used in the checker is in the synthesis directory. The rest of the library is meant to be agnostic so other tools with their own AST definitions can use type checking. Although there isn't any users of that atm it is a good thing to keep in the future. Unfortunately that means there might be some similar/duplicate data structures for somethings to provide and interim layer but that's fine. I think if you could do that as you last worked in it. After that just some small clippy things which you can add ignores for if the resolution is not straightforward. Also could you add a test for the new object destructuring assignment? That would round the passing tests up to a nice number! |
Looks good! Will merge tomorrow when at computer. |
Looks like nodejs was recently was burned by the destructuring Seems this case with destructuring isn't well know. Nothing on MDN about it https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment |
Fixes #98
Fixes #106
Working Tests
Assignable Destructuring
this
unbindingTODO
REVIEW
enum Assignable
abstract to use allASTImplementation
or justEznoParser
? https://github.com/lemueldls/ezno/blob/be38fe2ec683cbfc97fc5ea357a94b5278a99d65/checker/src/features/assignments.rs#L10-L14enum ObjectDestructuringField
keep theName(..)
variant, or share logic withMap { .. }
? (similar toenum AssignableObjectDestructuringField
) https://github.com/lemueldls/ezno/blob/be38fe2ec683cbfc97fc5ea357a94b5278a99d65/checker/src/features/assignments.rs#L24-L34