Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider using explicit TypeAlias names rather than expanded types in error messages #9381

Closed
NeilGirdhar opened this issue Aug 30, 2020 · 2 comments
Labels
feature topic-type-alias TypeAlias and other type alias issues

Comments

@NeilGirdhar
Copy link
Contributor

NeilGirdhar commented Aug 30, 2020

馃殌 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"
@AlexWaygood
Copy link
Member

See also #2968

@NeilGirdhar
Copy link
Contributor Author

@AlexWaygood Thanks, closed as duplicate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature topic-type-alias TypeAlias and other type alias issues
Projects
None yet
Development

No branches or pull requests

2 participants