Replies: 1 comment
-
|
I think you're right. The check that all overload return types are assignable to the implementation return type is not really necessary for soundness, but it is a useful consistency check, since it's probably a mistake to annotate an overload as returning a type outside what the implementation can return. I think ideally we would also add a check that the implementation return type be assignable to the union of the overload return types -- that check is actually needed for soundness. |
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.
-
The following causes a runtime error without any type-checker warning:
Looking at the typing specs on Implementation consistency,
this doesn't seem quite right, because a broader return type in the implementation will almost always cause runtime issues in the calling context or above, while a narrower return type in the implementation (coupled with overload consistency checks in the signature) should never cause type errors in the calling context:
Beta Was this translation helpful? Give feedback.
All reactions