Skip to content

Improve diagnostics when a variable is declared to have a type from the numbers module and an int/float/complex is passed #2563

@tubarao312

Description

@tubarao312

Summary

Integer integers are not considered numbers.Number. Also appears to happen for float and complex numbers.

from numbers import Number

a: Number = 1
#           ~
# Object of type `Literal[1]` is not assignable to `Number` (invalid-assignment)

Playground Link

Version

ty 0.0.12

Metadata

Metadata

Assignees

Labels

diagnosticsRelated to reporting of diagnostics.help wantedContributions especially welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions