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

support type annotations on global variables #43671

Merged
merged 39 commits into from
Feb 8, 2022
Merged

Commits on Jan 8, 2022

  1. add typing to global bindings

    new types should go at end of struct
    miguelraz authored and simeonschaub committed Jan 8, 2022
    Configuration menu
    Copy the full SHA
    f819538 View commit details
    Browse the repository at this point in the history
  2. support type annotations on global variables

    This is an initial proposal for supporting typed globals based on #43455.
    The syntax for this is either `global x::T` or just doing `x::T = 1` in
    global scope. It is even supported to add these annotations to globals
    from inside functions. The type declaration will then be applied when
    the method is defined and inside the function body conversion to the
    specified type will happen automatically, similar to type annotations
    for local variables.
    
    This conversion will not be applied if the assignment is not done inside
    the same scope of the type annotation however. This could potentially be
    supported as well, but the problem is that this would mean any
    assignment to a global variable - typed or not - would need to go
    through a call to `convert` first, since lowering can't know if a given
    binding already has a type annotation. This probably wouldn't be a good
    thing for latency and sysimage size and would add an invalidation risk.
    
    It is allowed to refine a type annotation, but there will be a warning.
    Widening the type or changing it to any other type that is not a subtype
    of the previous one is an error, since that could cause cached compiled
    code to become invalid.
    
    replaces #43455
    closes #964
    simeonschaub committed Jan 8, 2022
    Configuration menu
    Copy the full SHA
    ee478df View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    2846e34 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    b6e4587 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    a3e6c98 View commit details
    Browse the repository at this point in the history
  6. try to fix tests

    simeonschaub committed Jan 8, 2022
    Configuration menu
    Copy the full SHA
    bc38f26 View commit details
    Browse the repository at this point in the history
  7. fix inference test

    Lowering split up `i = i - 1` using an additional SSA value here, which
    should be completely harmless, but broke this test.
    simeonschaub committed Jan 8, 2022
    Configuration menu
    Copy the full SHA
    1791c3c View commit details
    Browse the repository at this point in the history
  8. fix analyzegc failures

    simeonschaub committed Jan 8, 2022
    Configuration menu
    Copy the full SHA
    c4161fd View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    28c8cba View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    646e2ab View commit details
    Browse the repository at this point in the history

Commits on Jan 16, 2022

  1. Configuration menu
    Copy the full SHA
    e0e0364 View commit details
    Browse the repository at this point in the history
  2. add docs

    simeonschaub committed Jan 16, 2022
    Configuration menu
    Copy the full SHA
    b28d542 View commit details
    Browse the repository at this point in the history
  3. add NEWS entry

    simeonschaub committed Jan 16, 2022
    Configuration menu
    Copy the full SHA
    b208fbf View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    d7e92f1 View commit details
    Browse the repository at this point in the history
  5. fix docs

    simeonschaub committed Jan 16, 2022
    Configuration menu
    Copy the full SHA
    ff22fc0 View commit details
    Browse the repository at this point in the history
  6. just remove ref to <:

    simeonschaub committed Jan 16, 2022
    Configuration menu
    Copy the full SHA
    e93e694 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2022

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

Commits on Jan 22, 2022

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

Commits on Jan 23, 2022

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

Commits on Jan 24, 2022

  1. fix serialization

    simeonschaub committed Jan 24, 2022
    Configuration menu
    Copy the full SHA
    931b7ba View commit details
    Browse the repository at this point in the history
  2. address review comments

    Change lowering s.t. types are always frozen before functions writing to
    a global are defined. `get_binding_type` now errors if the binding is
    still uninitialized. Also make multiple type declarations in local scope
    a runtime error.
    simeonschaub committed Jan 24, 2022
    Configuration menu
    Copy the full SHA
    e04c6be View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    346220a View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8989e6e View commit details
    Browse the repository at this point in the history

Commits on Jan 25, 2022

  1. fix whitespace snafu

    simeonschaub committed Jan 25, 2022
    Configuration menu
    Copy the full SHA
    de692a7 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b36f3e2 View commit details
    Browse the repository at this point in the history

Commits on Jan 26, 2022

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

Commits on Feb 4, 2022

  1. Configuration menu
    Copy the full SHA
    38d1b06 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1504a97 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    160ee63 View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2022

  1. Configuration menu
    Copy the full SHA
    a334a9b View commit details
    Browse the repository at this point in the history
  2. fix doctests

    simeonschaub committed Feb 7, 2022
    Configuration menu
    Copy the full SHA
    efdb986 View commit details
    Browse the repository at this point in the history

Commits on Feb 8, 2022

  1. Configuration menu
    Copy the full SHA
    645f155 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b442636 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    592c957 View commit details
    Browse the repository at this point in the history
  4. fix tests

    simeonschaub committed Feb 8, 2022
    Configuration menu
    Copy the full SHA
    59bc7c0 View commit details
    Browse the repository at this point in the history
  5. update test for #33243

    simeonschaub committed Feb 8, 2022
    Configuration menu
    Copy the full SHA
    29afe48 View commit details
    Browse the repository at this point in the history
  6. make test more robust

    simeonschaub committed Feb 8, 2022
    Configuration menu
    Copy the full SHA
    d265016 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    2183d33 View commit details
    Browse the repository at this point in the history