Skip to content

Include more descriptions of types in error messages #125

Closed
@JukkaL

Description

@JukkaL

Consider this code fragment:

s = 'x'
n = 1
s = n  # type check fails

The error message is Incompatible types in assignment or somesuch which is just plain uninformative. Say something like Cannot assign 'int' to 'str' instead. When the types are inferred, it might not be immediately obvious why an assignment is rejected.

There is also a similar issue with function argument types. Include both the actual and the expected type.

Shorten the types whenever possible to only include enough information to make the problem clear and obvious. So

Cannot assign func<...very long...> to tuple<...very long...>

is worse than

Cannot assign function to tuple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions