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

Improvements to properties + intrinsic types #157

Merged
merged 20 commits into from
Aug 8, 2024

Conversation

kaleidawave
Copy link
Owner

@kaleidawave kaleidawave commented Jun 3, 2024

300 passing 🎉

  • Replace todo! under /synthesis for fixes or unimplemented error (for Add fuzz target checker/fuzz/check_project_naive #152)

  • Under option (true by default): if for (let i = 0; ...) or similar where the initialiser is number like. Assume i has constraint of number (assigning to any other type is not an advisable pattern). Assuming this constraint would skip work that will be done when Inferred generic (poly type) constraints #35 is added!

  • Added TSC intrinsic string types

  • TSC Uppercase, Lowercase intrinsic string types

  • Added TSC NoInfer

  • Ezno CaseInsenstive

  • Added some WIP Ezno intrinsic number types

  • Added some WIP Not type and Exclusive type

  • Added new slice subtyping mechanism

  • Have got the mapped property key of mapped types partially working.

    • Including modifiers
    • GenericChain::Mapped
    • Access is pretty good
    • Subtyping is still a bit WIP
  • Have got delete checking in

    • No test for doing inside of function
    • Breaks the pop synthesis, so removing for now
    • As effect broken :(
  • in is handled a bit better across functions

    • Getting pinned down to decidable is quite difficult
  • Understanding break works

    • Turns out that was being run unknown as was trying to run 460 events on top level (default limit is 300)
    • Got it down to 360 by not queueing some SetVariables where it is in the scope up during application
    • And further down by changing the values in the test
    • However now the break isn't being fired. Might be to do with the carry, might not be ?
  • Delete as effect

  • Object.defineProperty and Object.getOwnPropertyDescriptor (constant functions)

    • PropertyValue::Configured
      • Might be bad for performance for a.push but oh well
  • Sorting for numerical properties

  • Sorting for later assignments (removed old weird .reverse thing)

  • Proxy

    • Added get and set for Proxy
    • Added basic subtyping for Proxy (probably doesn't work in more general cases)
  • Added Object.assign

  • Added configurable checks (change + delete)

  • Array.prototype.map

  • Register as effect

  • Merge definition hoisting into regular hoisting

  • Cyclic alias (+ improved cycle detection and checking here)

StringBuild test seems a bit temperamental :/

- Replace `todo!` under /synthesis for fixes or unimplemented error
@kaleidawave kaleidawave added bug Something isn't working checking Issues around checking enhancement New feature or request labels Jun 3, 2024
- Start on tree shaking for libraries
- Change TDMs from set to vec
- Fix for readonly
- Rearrange passing of calling input
- Add `Map`
- Split property logic between files
- merge apply_events_unknown into apply_events
- var reassignment
- extends on infer
- As well as `has` and `delete` operations
- Added Object.defineProperty & Object.getOwnPropertyDescriptor
- Added sorting for properties
- Changed undefined and null types
@kaleidawave
Copy link
Owner Author

kaleidawave commented Jul 14, 2024

259 🎉

Going to remove some WIP things (operator checks, failing events, .d.ts emit) and split in to separate PRs. Also the template literal strings array needs changing (but should do that in the parser first , could do in #173)

Before merging

  • Fix .map not calling error?
    • Also computed generics not working here
  • Have a look at mapped type issues (Including the new GenericChainLink variant)

@kaleidawave kaleidawave changed the title More checker improvements Improvments to properties + intrinsic types Jul 18, 2024
- Added Not type + disjoint calculation
- Improvements and fixes to mapped lookup
- Added non null assertion operator (currently only works on conditionals)
- Merged SpecialObject::ClassConstructor into regular SpecialObject::function
- Added `name` field to function (+ the edge cases)
- Add stats collector & `chronometer` to CLI
@kaleidawave
Copy link
Owner Author

269 🎉

failures:
    specification::collections::array_map
    specification::forward_inference::computed_generics_from_collection
    specification::staging::calling_type::array_slice_matching_pattern
    specification::staging::calling_type::properties_on_big_or
    specification::staging::calling_type::regexp_patterns
    specification::staging::exceptions_and_try_catch_finally::throw_through_internal_callback
    specification::staging::extras::exclusive
    specification::staging::mapped_types::as_rewrite
    specification::staging::mapped_types::negated_optionality
    specification::staging::mapped_types::negated_readonly
    specification::staging::mapped_types::optional
    specification::staging::mapped_types::specialisation

test result: FAILED. 269 passed; 12 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.05s

Hopefully can fix .map and make some progress on the others 🙏

@kaleidawave kaleidawave changed the title Improvments to properties + intrinsic types Improvements to properties + intrinsic types Jul 22, 2024
@kaleidawave
Copy link
Owner Author

For mapped types: the last thing to fix is subtyping based on the mapped type being on the left. The problem to solve is indexing a type based on a type key. This sort of works ATM for Array[number] but not much more. I have just added support for reading on ty["a" | "b"] eagerly in get_property_unbound via splitting the branch and building a Logical::Or.

For more complex types: There exists Logical::BasedOnKey for a value based on the RHS key. I think this should be extended to somehow RHS. Somehow the value should be based off get_properties with a filter?

Aside: this is duplicate of lookup generics get_key_on...? Will come back to this maybe with default generics, or covariant lookup.

Ahh its all really complicated and making this PR take a long time. But when it is done :chefskiss:


Once that works then will have the proper foundations for .map (which uses properties)

@kaleidawave
Copy link
Owner Author

Getting there on mapped types checking (access is 90% done). The real problem is indexing the RHS type (right_ty) with a mapped generic. Lots of complex behaviour there which isn't easily implemented by my general process which is just to start on it and find out. But as it turns out there have been a few problems to my initial attempts:

  • Walking properties on right_ty and backwards checking can cause things required on the left to be missed
  • Scanning the property type works if the main property is a mapped generic. Otherwise not, so needs some work

Need to break the pen and paper for this one 🤔

This PR won't implement #179

- Fixed some subtyping logic for the last part of mapped types
- Fixed some constant functions for Object.defineProperty
- Rearranged some of the internal structures
- Changed the way function calling diagnostics flows through functions
- Changed the way `this` is handled by getters and setters
- Fix class generics being leaked
- Rearranged to keep generics in their own environment
- Moved suggestions to be in a label, added standalone test and suggestions for imports
- Change `exports` to use internal `Map` structure
- Add proxies (get, set and subtyping)
- Remove definitions.rs and reusing hoisting
- Change stages (allows recursive aliases)
- Interface extends on own type
- Structure generic has own type
- Remove external maps for the above two
- Split Setter and property initialisation
- More
- Class type properties being overridden
- BasedOnKey right key and filter separation
- Clippy fixes
- Fixes to usages of array push
- Class object creation with closures
@kaleidawave kaleidawave marked this pull request as ready for review August 8, 2024 08:07
- Fix to perf action
- staging -> specification
- temp fix for list (hmm)
@kaleidawave
Copy link
Owner Author

300 🎉

image

- Hopeful fix for split in perf&size
- Change spaces to tabs in specification
@kaleidawave kaleidawave merged commit e6f6ffd into main Aug 8, 2024
9 checks passed
@kaleidawave kaleidawave deleted the checker-improvements-036 branch August 8, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working checking Issues around checking enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant