Compiling with swift-numerics failed with error in ApproximateEquality.swift

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

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

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

and

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

Xcode: 11.3.1
Swift: 5

I suggest reporting that problem to the author of the Chart library. There's not much we can do here without more information.

I've seen the error before, it's your Swift version, try compiling it with 5.4 or 5.5. The Swift 5.0 compiler does not like swift-numerics.

Terms of Service

Privacy Policy

Cookie Policy