swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

[SR-10904] DarwinCompatibility: Unit.init(symbol:) should not be a required initialiser #3306

Open spevans opened 5 years ago

spevans commented 5 years ago
Previous ID SR-10904
Radar None
Original Reporter @spevans
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Foundation | |Labels | Bug, Linux | |Assignee | None | |Priority | Medium | md5: 0df819b3842f101923c78bdfa4d29780

Issue Description:

According to https://developer.apple.com/documentation/foundation/unit/1690760-init

Unit.init(symbol:)

should not have a required modifier as it does here: https://github.com/apple/swift-corelibs-foundation/blob/e1071a9d90686b74faeabb9b6611cbdc1945d388/Foundation/Unit.swift#L155

However removing the modifier leads to other issues:

This line https://github.com/apple/swift-corelibs-foundation/blob/e1071a9d90686b74faeabb9b6611cbdc1945d388/Foundation/Measurement.swift#L324

spevans commented 5 years ago
cc @millenomi
millenomi commented 5 years ago

This is an acceptable break from Darwin API as it allows the whole to work; Darwin is fundamentally violating constructor assumptions here.