Skip to content

TypedPython gate: detect type-changing rebinding and mixed-element containers #22

Closed

Description

@b-re-w

What

The two §3.1 forbidden items the gate does not catch yet (SPEC N-6): x = 1 followed by x = "a", and [1, "a"] inferred as list[int | str]. Pyrefly 1.3.2 reports neither, and its type report has no entries for assignment targets. Find a source for the inferred types of assignment targets, for example Pyrefly's infer output or reading the stored names back through a load, and report both: warnings in checked, errors in compiled.

Done when

Tests for both cases go red, then green. An explicitly annotated union (list[int | str]) is not flagged.

Activity

  1. b-re-w commented on Oct 3, 2026

    @b-re-w
    MemberAuthor

    Landed in develop via #64 (which carried the stacked PR for this issue).

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions