Swift: Generic Initializer: Ambigious Method Call

IDE: Fire
Version: 9.0.97.2071, 9.1.100.2076 (was originally discovered in 8.4 beta 2 month ago)
Target: Java
Description:

For BoxedDouble and Coordinate defined next:

public class BoxedDouble {
	
	fileprivate let _underlyingEntity: Double
	public init(_ doubleValue: Double){
		_underlyingEntity = doubleValue
	}

}

//making BoxedDouble conform to Equatable, Comparable

public struct Coordinate<T: Comparable> {
	
	/*! primarily designated to store longitude in degrees */
	public var x: T
	/*! primarily designated to store latitude in degrees */
	public var y: T
	
	public init(x: T, y: T){
		self.x = x
		self.y = y
	}
}

the following call:

let coordinate = Coordinate<BoxedDouble>(x: BoxedDouble(3.0), y: BoxedDouble(3.0))

will result in error E110: Ambiguous call to overloaded method "<Constructor>"

Thanks, logged as bugs://76945

bugs://76945 got closed with status nochangereq.

This works fine (once i implement Comparable on BoxedDouble).

1 Like