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

Already on GitHub? Sign in to your account

Implement typing `Literal` support #1648

Open
jakebailey opened this issue Oct 8, 2019 · 1 comment

Comments

@jakebailey
Copy link
Member

commented Oct 8, 2019

After #1640 stops the crashes, we'll have to add real Literal support. This involves:

  • Adding a new class PythonLiteral and adding it to the typing module.
  • Modify the SpecificTypeConstructor delegate type to accept IMembers instead of IPythonTypes, since we now need to be able to have non-types.
  • Potentially undo some of #1631, since None would be a valid non-type and could be passed through, allowing NoneType to return with None as its sole instance.

Related to #535, but this is a more specific case.

@jakebailey

This comment has been minimized.

Copy link
Member Author

commented Oct 8, 2019

This is probably going to require some hefty changes to the TypeAnnotation stuff, since right now if a constant string is seen, we assume that it's supposed to be another type and parse it, but if it's a literal, we don't want to do that. (Maybe we shouldn't be doing that at all past a top level annotation being a string; need to read the spec.)

That and TypeAnnotation also relies on annotations be solely constructed with IPythonType.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.