Clarification on Literal subtype behavior with arithmetic operations. #2135
Unanswered
u-harshitha007
asked this question in
Q&A
Replies: 1 comment
-
|
It is generally not specified how precise type inference should be. In your example, if |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
While reading the Literal specification, I noticed that it states
that methods from the parent type are inherited by Literal types,
and that expressions like
foo + 5result in typeint.I wanted to clarify whether this behavior is considered normative
across all type checkers, or whether tools are allowed to preserve
more precise literal information in such cases.
Thanks in advance for any clarification.
Beta Was this translation helpful? Give feedback.
All reactions