No longer able to type check expressions with Xcode 10.2 (caused by new SIMD API?)

I did some more testing and the following demonstration program seems to suggest that this regression is caused (at least in part) by the fact that float2 is now generic (a typealias for SIMD2<Float>).

It would be interesting to know if the behavior of the following program was the same in Xcode 10.1 and macOS 10.14.3. If it wasn't, then the compile time regression in the OP is more general, and not something that only has to do with the SIMD types.


//-----------------------------------------------------------------------------
// This program is meant to demonstrate the difference in the compiler's
// ability to type check the expression returned by the function foo,
// depending on wether Point is generic or not.
//
// So please comment out A and B to test both of them. A will compile
// quickly while B will be unable to type check within reasonable time,
// at least when I try it out with the def toolchain of Xcode 10.2 as
// well as with the most recent dev snapshot (2019-04-10).
//-----------------------------------------------------------------------------

typealias Point = Point2D_Float     // A
//typealias Point = Point2D<Float>  // B


//-----------------------------------------------------------------------------
// Note that:
// A ~ How it was prior to Xcode 10.2, when float2 was not generic.
// B ~ How it is in Xcode 10.2, when float2 is generic (SIMD2<Float>).
//-----------------------------------------------------------------------------


func foo(_ a: Point, _ b: Point, _ c: Point, _ d: Point) -> Point {
    return 2*(3*a - b) + (4*c - d) // Typechecks quickly if A but sloooow if B.
}


struct Point2D_Float {
    var x, y : Float
    init(_ x: Float, _ y: Float) { (self.x, self.y) = (x, y) }
    
    static func +(lhs: Point2D_Float, rhs: Point2D_Float) -> Point2D_Float {
        return Point2D_Float(lhs.x + rhs.x, lhs.y + rhs.y)
    }
    static func -(lhs: Point2D_Float, rhs: Point2D_Float) -> Point2D_Float {
        return Point2D_Float(lhs.x - rhs.x, lhs.y - rhs.y)
    }
    static func *(lhs: Float, rhs: Point2D_Float) -> Point2D_Float {
        return Point2D_Float(lhs * rhs.x, lhs * rhs.y)
    }
}

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: 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 result = foo(Point(1, 2), Point(3, 4), Point(5, 6), Point(7, 8))
print(result)