8000 Please consider using explicit TypeAlias names rather than expanded types in error messages · Issue #9381 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content
Please consider using explicit TypeAlias names rather than expanded types in error messages #9381
Closed
@NeilGirdhar

Description

@NeilGirdhar

🚀 Feature

Now that we have explicit type aliases, would it be possible to use explicit TypeAlias names rather than expanded types in error messages? Maybe by keeping track of the aliases used in the definition of a type annotation, and using those aliases in error messages?

Pitch

An error message like this:

cmm/model/iterate.py:202: error: Incompatible types in assignment (expression has type "Union[Any, PyTreeLike, Tuple[Any, ...], List[Any], Dict[Hashable, Any], None]", variable has type "RecordedEncodingConfiguration")
cmm/problem/pooling.py:111: error: "Dict[str, Union[Any, PyTreeLike, Tuple[Any, ...], List[Any], Dict[Hashable, Any], None]]" has no attribute "prediction_map"

Would be much easier to read like this:

cmm/model/iterate.py:202: error: Incompatible types in assignment (expression has type "PyTree", variable has type "RecordedEncodingConfiguration")
cmm/problem/pooling.py:111: error: "Dict[str, PyTree]" has no attribute "prediction_map"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0