-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Use any
and all
to make collection non-optional
#4573
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
Comments
Clever and convenient, but we'd have to be sure we are okay with the
refined type of `vals` not being a subtype of its original type (because of
List invariance).
|
I think we should only allow narrowing if the original variable is annotated with something like |
Then your example won't work as written. Also, I have a vague sense of "déjà vu" about this. |
OK, I will updated it.
Because I proposed and implemented a similar feature for |
I think if we only do this for covariant containers then it feels pretty niche and if we do it for invariant containers then it has problems, so I'm going to close this, but if somebody disagrees with me feel free to reopen |
I have seen patterns like this several times:
It would be convenient if binder could understand this for covariant collections.
The text was updated successfully, but these errors were encountered: