@@ -37,6 +37,17 @@ public enum CanImportVersion {
3737 case underlyingVersion( VersionTuple )
3838}
3939
40+ enum BuildConfigurationError : Error , CustomStringConvertible {
41+ case experimentalFeature( name: String )
42+
43+ var description : String {
44+ switch self {
45+ case . experimentalFeature( let name) :
46+ return " 'name' is an experimental feature "
47+ }
48+ }
49+ }
50+
4051/// Captures information about the build configuration that can be
4152/// queried in a `#if` expression, including OS, compiler version,
4253/// enabled language features, and available modules.
@@ -227,6 +238,7 @@ public protocol BuildConfiguration {
227238 /// - Parameters:
228239 /// - name: The name of the object file format.
229240 /// - Returns: Whether the target object file format matches the given name.
241+ @_spi ( ExperimentalLanguageFeatures)
230242 func isActiveTargetObjectFileFormat( name: String ) throws -> Bool
231243
232244 /// The bit width of a data pointer for the target architecture.
@@ -293,9 +305,11 @@ public protocol BuildConfiguration {
293305}
294306
295307/// Default implementation of BuildConfiguration, to avoid a revlock with the
296- /// swift repo.
308+ /// swift repo, and breaking clients with the new addition to the protocol .
297309extension BuildConfiguration {
298- func isActiveTargetObjectFileFormat( name: String ) throws -> Bool {
299- return false
310+ /// FIXME: This should be @_spi(ExperimentalLanguageFeatures) but cannot due
311+ /// to rdar://147943518, https://github.com/swiftlang/swift/issues/80313
312+ public func isActiveTargetObjectFileFormat( name: String ) throws -> Bool {
313+ throw BuildConfigurationError . experimentalFeature ( name: " _objectFileFormat " )
300314 }
301315}
0 commit comments