let u = SIMD2<Float>(0, 1)
let v = SIMD2<Float>(1, 2)
let r = [ // ERROR: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
2*u + 3*v,
4*u + 5*v
]

I've described the same problem in another thread and reported it as SR-10461, but this thread is an attempt to present it more clearly to try and gain some attention and priority.

Our projects use a lot of SIMD vectors and because of this regression (first in Xcode 10.2) they've become a pain to work on.

And just to be clear: This issue is not particular to the new SIMD API.

As demonstrated here.

struct Point2D<Scalar: BinaryFloatingPoint> {
var x, y : Scalar
init(_ x: Scalar, _ y: Scalar) { (self.x, self.y) = (x, y) }
static func +(lhs: Point2D, rhs: Point2D) -> Point2D {
return Point2D(lhs.x + rhs.x, lhs.y + rhs.y)
}
static func *(lhs: Scalar, rhs: Point2D) -> Point2D {
return Point2D(lhs * rhs.x, lhs * rhs.y)
}
}
let u = Point2D(0, 1)
let v = Point2D(1, 2)
let r = [ // ERROR: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
2*u + 3*v,
4*u + 5*v
]

(Note that if Point2D is rewritten to not be generic, it will type check quickly.)

Is this a prioritized issue? If not, doesn't the new SIMD API make it so?

import AppKit
let u = CGPoint(x: 0, y: 1)
let v = CGPoint(x: 1, y: 2)
let r = [ // ERROR: The compiler is unable to type-check this expression in reasonable time; try breaking up the expression into distinct sub-expressions
2*u + 3*v,
4*u + 5*v
]

Which I find a bit strange, since CGPoint isn't generic ...

I tried recreating your example with CGPoint and I think the issue is it doesn't declare operators for addition and multiplication with a CGFloat.

When the second element in the array is removed I'm seeing the ambiguous error message.

let u = CGPoint(x: 0, y: 1)
let v = CGPoint(x: 1, y: 2)
let r = [ // type of expression is ambiguous without more context
2 * u + 3 * v,
//4 * u + 5 * v
]

This compiles without error, but I understand it doesn't answer your original question.

import Cocoa
extension CGPoint {
static func + (lhs: CGPoint, rhs: CGPoint) -> CGPoint {
return CGPoint(x: lhs.x + rhs.x, y: lhs.y + rhs.y)
}
static func * (lhs: CGFloat, rhs: CGPoint) -> CGPoint {
return CGPoint(x: lhs * rhs.x, y: lhs * rhs.y)
}
}
let u = CGPoint(x: 0, y: 1)
let v = CGPoint(x: 1, y: 2)
let r = [
2 * u + 3 * v,
4 * u + 5 * v
]

Does annotating the type of r fix it? I suspect the compiler is trying a whole bunch of combinations, to make sure all elements have compatible types, which is wasting a lot of time.