Swift Compiler never finishes compiling lazy collection reverse/filter/map
| Originator: | justatheory | ||
| Number: | rdar://17796401 | Date Originated: | 2014-07-24 |
| Status: | Closed | Resolved: | |
| Product: | Xcode | Product Version: | 6.0 (6A267n) |
| Classification: | Developer Tools | Reproducible: | Always |
Summary:
In this forum post:
https://devforums.apple.com/message/1010631#1010631
User jckarter posted this code:
let two_one = Array(lazy([1, 2, 3, 4]).reverse().filter { $0 % 2 == 0 }.map { $0 / 2 })
Which seems cool. (Aside: lazy seems to be undocumented). So I pasted it into a Playground, where it never finished. The CPU spins up to 200%, and after a while Xcode freezes and I have to terminate it.
If I only use lazy reverse() it works fine. But both lazy filter() and lazy map() brings the compiler into a seemingly endless loop.
Version:
6.0 (6A267n)
Configuration:
I'm on a MacBook Air (1.7 GHz Core i7, 8GB RAM) running Xcode 6 beta 4.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
David Wheeler on 07-Sep-2014 01:43 PM
Appears to indeed be fixed in beta 7. Thanks!
Apple Developer Relations on 05-Sep-2014 01:04 PM
Engineering has provided the following information:
We believe this issue has been addressed in the latest Xcode 6 beta.
This is a pre-release version of the complete Xcode developer toolset for Mac, iPhone, iPod touch, and iPad. Please review the Release Notes before installing. Xcode 6 beta requires OS X Mavericks 10.9.3 or later. Please test with this release, and update your bug report with the results.
Xcode 6 beta - Build 6A280n
Mac Developers: Use the 'OS X Yosemite Developer Preview' tab on this page: https://developer.apple.com/devcenter/mac/index.action#
iOS Developers: Use the 'iOS 8 Beta' tab on this page - https://developer.apple.com/devcenter/ios/index.action#
Please let us know if that resolves the issue for you by updating your bug report.