Skip to content

Clean-up type variable scope and binding #4814

Closed

Description

@ilevkivskyi

Currently the code around type variable binding in functions is a bit unclear and does some strange things like binding typer variables before function type is analyzed and depending on TypeVarQuery returning short (unqualified) names.

Activity

  1. ilevkivskyi commented on Aug 19, 2018

    @ilevkivskyi
    MemberAuthor

    Another related comment here is that we have a bit too many "things" related to type variables (in addition to TypeVarScope mentioned above):

    • TypeVarExpr
    • TypeVarDef
    • TypeVarType
    • TypeVarId
      We can probably simplify a bit the model of how type variables work.
  2. ilevkivskyi commented on Feb 24, 2019

    @ilevkivskyi
    MemberAuthor

    Probably it makes sense to clean up (or at least document) various things related to type variable scopes while we are working on the new semantic analyzer. I just discovered an inconsistency in new analyzer, it was using full type variable name where short one was expected. Without documentation, such errors are easy to make.

  3. self-assigned this
    on Feb 24, 2019
  4. removed their assignment
    on Dec 9, 2019
  5. ilevkivskyi commented on Jun 15, 2024

    @ilevkivskyi
    MemberAuthor

    FWIW I more happy now with how type variables work (e.g. we use namespaces everywhere). There still may be bugs, I think tvar_scope.py is somewhat over-complicated, but we can handle issues on one-by-one basis now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    metaIssues tracking a broad area of workpriority-1-normalrefactoringChanging mypy's internalssemantic-analyzerProblems that happen during semantic analysis

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions