Skip to content

don't mark import a as a as unused import #1961

@jorenham

Description

@jorenham

Describe the Bug

pyrefly reports an unused-import warning for the following implicit re-export:

from math import tau as tau

The other type-checkers don't, because the convention (it might even be a typing spec thing) is to treat import {name} as {name} as a re-export, i.e. {name} should be a public symbol in that module.

See https://github.com/scipy/scipy-stubs/blob/4b2ee9a7a917ebd8918caf1ab51146ba4898a34b/scipy-stubs/_lib/_array_api_compat_vendor.pyi for a real-world example of this (at runtime there is no __all__).

Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAENqALgBZ0Q3G6VN1OoBXOqjh9BAHXQgAvgBoQqAMZMIANxgAxaDAposeImRlA

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomerslanguage-serverIssues specific to our IDE integration rather than type checking

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions