Home > Blockchain >  Compiling with swift-numerics failed with error in ApproximateEquality.swift
Compiling with swift-numerics failed with error in ApproximateEquality.swift

Time:01-09

I import a library 'Chart' as project into my project and compile, the result is failed due to an error related to a dependency package 'swift-numerics'.

The error indicates 'Type of expression is ambiguous without more context' in 2 locations in ApproximateEquality.swift of RealModule of the package, where both imply something wrong like ' .\magnitude' as below.

the package comes along with officially download demo project. Xcode: 11.3.1 Swift: 5

    public func isApproximatelyEqual(
        to other: Self,
        relativeTolerance: Magnitude = Magnitude.ulpOfOne.squareRoot(),
        norm: (Self) -> Magnitude = \.magnitude
    ) -> Bool

and here

    public func isApproximatelyEqual( 
        to other: Self,
        absoluteTolerance: Magnitude,
        relativeTolerance: Magnitude = 0
    ) -> Bool {
        self.isApproximatelyEqual(
        to: other,
        absoluteTolerance: absoluteTolerance,
        relativeTolerance: relativeTolerance,
        norm: \.magnitude
    )
  }

CodePudding user response:

Update to Xcode 13, Swift 5.5. You cannot possibly expect these packages to work with your super-outdated version of Xcode.

  •  Tags:  
  • Related