Skip to content

Consider deferring module top level in type checker #6356

Open

Description

@ilevkivskyi

We currently never defer module top levels in type checker. This can cause some Cannot determine type of x errors in import cycles. They are real in some sense, because such code would almost certainly fail at runtime. However, this might sometimes be useful in stubs (as practice shows, this is however not important and shows up only in highly entangled import cycles, such as e.g. builtins SCC).

Activity

  1. ilevkivskyi commented on Feb 7, 2019

    @ilevkivskyi
    MemberAuthor

    See #6312 for an example when the error happens.

  2. russelldavis commented on Feb 7, 2019

    @russelldavis

    They are real in some sense, because such code would almost certainly fail at runtime.

    I think it's import to distinguish the ones that would fail at runtime from the ones that would not. I think there are a lot of common cases that do not fail at runtime that are worth supporting.

  3. ilevkivskyi commented on Sep 3, 2019

    @ilevkivskyi
    MemberAuthor

    With some more experience, it looks like this can cause troubles.

    More generally, the deferral in type checker is different from both semantic analyzer and the daemon: the first two defer either module top level or top-level function and defer until fixed point (our large cut-off), while type checker never defers module top levels, and defers innermost functions, and have hard-coded small number of deferrals.

  4. self-assigned this
    on Sep 3, 2019
  5. ilevkivskyi commented on Sep 24, 2019

    @ilevkivskyi
    MemberAuthor

    (Raising priority to high since this appeared again.)

  6. removed their assignment
    on Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions