Expression was too complex to be solved in reasonable time
| Originator: | michaelgwelch | ||
| Number: | rdar://21951545 | Date Originated: | |
| Status: | DUPLICATE OF 19836070 OPEN | Resolved: | |
| Product: | XCode | Product Version: | |
| Classification: | Reproducible: |
Summary:
I'm writing a simple predicate using closures:
let isSpace:Character -> Bool = { c in
c == " " || (c == "\n" || (c == "\r" || c == "\t")) }
After initiating a build, the compiler hangs for a few seconds and then warns:
Tokenizer.swift:98:33: Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions
If I remove two of the subexpressions its okay. The third one tends to break it.
Steps to Reproduce:
1. Start a new project and choose console app
2. In Main add the line above so that main.swift looks like
import Foundation
print("Hello, World!")
let isSpace:Character -> Bool = { c in
c == " " || (c == "\n" || (c == "\r" || c == "\t")) }
I get the warning.
I can work around this by adding explicitly types
let isSpace:Character -> Bool = { (c:Character) -> Bool in
c == " " || c == "\n" || c == "\r" || c == "\t" }
Expected Results:
Actual Results:
Version:
Xcode 7 beta 4 (7a165t)
OS X 10.10.4
Notes:
Configuration:
As far as I know it's reproducible in every code file.
Attachments:
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!
This one is still open and is a duplicate of 19836070
Still happens in Xcode 9