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

Rework Collections for Expect and Name #439

Merged
merged 24 commits into from
Jan 14, 2023
Merged

Commits on Jan 9, 2023

  1. [ci skip] Add substitution of names

    Remove the collection Expect construct.
    Instead, we use generics now and substitution of
    generics to deal with unification of collections.
    
    - Ignore collection type in output
    - Make temporary variables top-level
    
    Need to augment the unification rule for types a
    bit. If generics match and any generic is
    temporary, these must be substituted as well.
    JSAbrahams committed Jan 9, 2023
    Configuration menu
    Copy the full SHA
    d7eb8fe View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bd7082f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    90d135d View commit details
    Browse the repository at this point in the history
  4. [ci skip] Create two constraints for every col

    - __iter__() call, which gives iterator.
      We constrain this using a temporary type
    - __next__() call, whose return type is
      constrained to the collection type
    JSAbrahams committed Jan 9, 2023
    Configuration menu
    Copy the full SHA
    cbe1add View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    64d7029 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0c9f674 View commit details
    Browse the repository at this point in the history
  7. [ci skip] Get rid of weird Generic NodeTy

    Need to generalize how we convert mamba types
    to Python types in generate stage.
    In particular:
    - When encountering types in the wild
    - When encountering constructors in the wild
    
    And _only_ in those situations so we don't
    accidentally change identifiers with say class
    names.
    JSAbrahams committed Jan 9, 2023
    Configuration menu
    Copy the full SHA
    ae06d7f View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2023

  1. Configuration menu
    Copy the full SHA
    6ef10db View commit details
    Browse the repository at this point in the history
  2. Also get rid of tuple construct

    Makes unification logic much simpler.
    JSAbrahams committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    6d534f0 View commit details
    Browse the repository at this point in the history
  3. [ci skip] Remove NameVariants

    Now easier to check whether something callable
    or tuple.
    Also simply generate by not looking at type
    annotations, except for class arguments.
    We are now dependent on the check stage to
    annotate variables
    JSAbrahams committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    e5d6cbd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7beaa09 View commit details
    Browse the repository at this point in the history
  5. [ci skip] Match generics when checking parent

    When looking up classes in context, we convert
    generic parents to concrete parents (in the form
    of StringNames).
    
    So, Collection[Int] is a super of Set[Int]:
    - Set has a parent Collection[Int]
    - We check that Collection[Int] is super of
      itself:
      - The first part is equal to itself.
        We also see that it has the same amount of
        generics as itself.
        - We proceed to perform this now for each
          generic by matching them.
    JSAbrahams committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    e471732 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    45d4cb3 View commit details
    Browse the repository at this point in the history

Commits on Jan 11, 2023

  1. Rework identifier matching with ty, expr

    We added extra logic to deal with:
    - tuple literals
    - streamlining of tuples of identifiers
    
    Tuple matching still trips up when not matching
    with tuple literals.
    Perhaps we do need some logic in the unification
    stage, but this should be a last resort.
    JSAbrahams committed Jan 11, 2023
    Configuration menu
    Copy the full SHA
    77a087d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ad2cbad View commit details
    Browse the repository at this point in the history
  3. [ci skip] Recursively deconstruct builders

    Also match identifier with any expression if no
    type present.
    JSAbrahams committed Jan 11, 2023
    Configuration menu
    Copy the full SHA
    72981c9 View commit details
    Browse the repository at this point in the history

Commits on Jan 12, 2023

  1. [ci skip] Fix name union

    And remove unnecessary push_ty in unify_ty.
    JSAbrahams committed Jan 12, 2023
    Configuration menu
    Copy the full SHA
    38e9a51 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    e9fbb6b View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    46ba1ba View commit details
    Browse the repository at this point in the history
  4. Add extra __str__ rule to unify stage

    For tuples we make an exception by iterating over
    the elements and checking that they each define
    __str__().
    
    Also add extra rule for self.
    In union, self is always equal to entity_name.
    Other arguments are left as-is.
    JSAbrahams committed Jan 12, 2023
    Configuration menu
    Copy the full SHA
    896cf25 View commit details
    Browse the repository at this point in the history
  5. Ensure nested Unions to_py deterministic

    Should restructure name such the Name can have
    nested unions.
    JSAbrahams committed Jan 12, 2023
    Configuration menu
    Copy the full SHA
    aaf2c25 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    a7ff495 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    c83cb10 View commit details
    Browse the repository at this point in the history

Commits on Jan 14, 2023

  1. Configuration menu
    Copy the full SHA
    cb8fb18 View commit details
    Browse the repository at this point in the history