Expression was too complex to be solved in reasonable time

Doing a tutorial from RayWenderlich.

I have four bool values: topLeft, bottomLeft, topRight, and bottomRight

the following line throws an error:
let value = Int(topLeft.hashValue) | Int(topRight.hashValue) << 1 |
Int(bottomLeft.hashValue) << 2 | Int(bottomRight.hashValue) << 3

"Expression was too complex to be solved in reasonable time; consider
breaking up the expression into distinct sub-expressions."

This seems like a bug in the compiler, no? Is there actually a way to break
that up?

···

--
Nate Birkholz

Doing a tutorial from RayWenderlich. https://www.raywenderlich.com/125313/make-game-like-candy-crush-spritekit-swift-part-4

I have four bool values: topLeft, bottomLeft, topRight, and bottomRight

the following line throws an error:
let value = Int(topLeft.hashValue) | Int(topRight.hashValue) << 1 | Int(bottomLeft.hashValue) << 2 | Int(bottomRight.hashValue) << 3

yeah,

let value1 = Int(topRight.hashValue) << 1
let value2 = Int(bottomLeft.hashValue) << 2
let value3 = Int(bottomRight.hashValue) << 3

let value = Int(topLeft.hashValue) | value1 | value2 | value3

"Expression was too complex to be solved in reasonable time; consider breaking up the expression into distinct sub-expressions."

This seems like a bug in the compiler, no? Is there actually a way to break that up?

This is a known issue that got worse with the new integer oriented protocols, especially with shifts.

Slava

···

On Oct 24, 2017, at 3:05 PM, Nate Birkholz via swift-users <swift-users@swift.org> wrote:

--
Nate Birkholz
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Thanks, Slava!

···

On Tue, Oct 24, 2017 at 3:05 PM, Slava Pestov <spestov@apple.com> wrote:

On Oct 24, 2017, at 3:05 PM, Nate Birkholz via swift-users < > swift-users@swift.org> wrote:

Doing a tutorial from RayWenderlich. https://www.
raywenderlich.com/125313/make-game-like-candy-crush-spritekit-swift-part-4

I have four bool values: topLeft, bottomLeft, topRight, and bottomRight

the following line throws an error:
let value = Int(topLeft.hashValue) | Int(topRight.hashValue) << 1 |
Int(bottomLeft.hashValue) << 2 | Int(bottomRight.hashValue) << 3

yeah,

let value1 = Int(topRight.hashValue) << 1
let value2 = Int(bottomLeft.hashValue) << 2
let value3 = Int(bottomRight.hashValue) << 3

let value = Int(topLeft.hashValue) | value1 | value2 | value3

"Expression was too complex to be solved in reasonable time; consider
breaking up the expression into distinct sub-expressions."

This seems like a bug in the compiler, no? Is there actually a way to
break that up?

This is a known issue that got worse with the new integer oriented
protocols, especially with shifts.

Slava

--
Nate Birkholz
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

--
Nate Birkholz