-
Notifications
You must be signed in to change notification settings - Fork 125
Open
Labels
attribute accessInstance attributes, class attributes, etc.Instance attributes, class attributes, etc.bugSomething isn't workingSomething isn't workingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc
Milestone
Description
Summary
The following code passes without any errors.
l = []
l[0]: int = "foo"
class C:
declared: int
c = C()
c.unresolved: int = "foo"
c.declared: str = "foo"
I thought these should be reported as type errors, but it seems that mypy and pyright treat such annotated assignments as "semantically invalid" and report errors without type checking.
In any case, since the current version of ty does not report any problems for this, some kind of fix should be made. In particular, the lack of checking for attribute existence (c.unresolved
) is an obvious bug that should be fixed.
see also: microsoft/pylance-release#537
Version
ty 0.0.1a6 (ruff@83a036960)
sharkdp, ilius and carljm
Metadata
Metadata
Assignees
Labels
attribute accessInstance attributes, class attributes, etc.Instance attributes, class attributes, etc.bugSomething isn't workingSomething isn't workingtyping semanticstyping-module features, spec compliance, etctyping-module features, spec compliance, etc