-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
generics Instantiated as null : {} causes other type errors to disappear #3733
Comments
I believe what is happening here is that you're getting Surprisingly, |
Thanks for the clarification. It seems then that in e.g. |
@DanielRosenwasser What surprises me is that the behavior of |
I think this is a duplicate of #1436, as @DanielRosenwasser said. I am still in favor of not widening when we infer a type argument. As @ahejlsberg points out, the cost is that we have to have a general algorithm for walking a type and performing widening, and the algorithm has to be resilient to circularities in the type. I don't think this is unreasonable. We do this for all the other type walks. |
Examples:
Here, any time
new C(1)
is used it should have the typeC<number>
and not unify withC<string>
. It seems likeR
not being known innew C(null)
prevents these other type errors from occurring.The text was updated successfully, but these errors were encountered: