Skip to content

messages: improve concrete_only_{call,assign} #8832

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

grahamc
Copy link

@grahamc grahamc commented May 15, 2020

The comment in the code near where these functions are called was more descriptive than the message itsnelf

The comment in the code near where these functions are called was more descriptive than the message itsnelf
Copy link
Collaborator

@TH3CHARLie TH3CHARLie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think it's great to have better messages. To pass tests, you need to locate the error message"Can only assign concrete classes to a variable of type {}: in the test suite and add the additional part accordingly. cc @ethanhs

@@ -1222,11 +1222,16 @@ def bad_proto_variance(self, actual: int, tvar_name: str, expected: int,
self.fail(msg, context)

def concrete_only_assign(self, typ: Type, context: Context) -> None:
self.fail("Can only assign concrete classes to a variable of type {}"
self.fail("Can only assign concrete classes to a variable of type {}: "
"Only non-abstract non-protocol classes can be assigned to "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may better with self.note to denote the hint.

@97littleleaf11
Copy link
Collaborator

Thanks for your PR! Could you please merge the current master and fix the test errors?

@hauntsaninja
Copy link
Collaborator

Closing as stale. If someone wants to pick this up, I liked the note suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants