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
[SR-6892] lazy sequences are a bit tricky with sometimes sub-optimal overload resolution #49441
Comments
This looks like a weird wrinkle in overload resolution. FWIW, adding this explicit overload to the stdlib makes the second snippet work as expected:
(We have the same definition in a conditional extension on |
/cc @xedin |
FWIW: on current master the double-lazy expression is ambiguous, so the only option is to use the single |
@moiseev Interestingly enough version with two "lazy" doesn't type-check on master because it's ambiguous in both 3 and 4 mode:
|
@xedin yeah I noticed. And it's great. I nudges the user toward the right solution, i.e. using a single |
Oh right, I tried my stdlib workaround on a swift-4.1 build. A direct definition of `LazyMapSequence.lazy` makes the expression compile on master, too. (I don't think we need to add it, though.) |
Additional Detail from JIRA
md5: 33d7c6781173343b1032a21d8fde0644
Issue Description:
what I want to write is:
but done lazily. So my first idea was
which unfortunately doesn't work as it tries to create an array of all integers first 😉. Then I helped the compiler a little by doing this
which works fine but is very ugly.
Now it turns out that you can do
which works! The odd thing is that adding an extra lazy makes it less lazy 😃
The text was updated successfully, but these errors were encountered: