@@ -656,29 +656,23 @@ private func diagnoseLikelyTargetOSTest(
656656 return IfConfigDiagnostic . likelyTargetOS ( syntax: ExprSyntax ( reference) , replacement: nil ) . asDiagnostic
657657 }
658658
659- guard let ( function, argument) = targetOSNameMap [ osName] else { return nil }
660- let replacement = FunctionCallExprSyntax ( callee: DeclReferenceExprSyntax ( baseName: . identifier( function) ) ) {
661- LabeledExprSyntax ( expression: DeclReferenceExprSyntax ( baseName: . identifier( argument) ) )
662- }
659+ guard let replacement = targetOSNameMap [ osName] else { return nil }
663660
664- return IfConfigDiagnostic . likelyTargetOS (
665- syntax: ExprSyntax ( reference) ,
666- replacement: ExprSyntax ( replacement)
667- ) . asDiagnostic
661+ return IfConfigDiagnostic . likelyTargetOS ( syntax: ExprSyntax ( reference) , replacement: replacement) . asDiagnostic
668662}
669663
670664// TARGET_OS_* macros that don’t have a direct Swift equivalent
671665private let unmappedTargetOSNames = [ " WIN32 " , " UNIX " , " MAC " , " IPHONE " , " EMBEDDED " ]
672- private let targetOSNameMap : [ String : ( function : String , argument : String ) ] = [
673- " WINDOWS " : ( " os " , " Windows " ) ,
674- " LINUX " : ( " os " , " Linux " ) ,
675- " OSX " : ( " os " , " macOS " ) ,
676- " IOS " : ( " os " , " iOS " ) ,
677- " MACCATALYST " : ( " targetEnvironment " , " macCatalyst " ) ,
678- " TV " : ( " os " , " tvOS " ) ,
679- " WATCH " : ( " os " , " watchOS " ) ,
680- " VISION " : ( " os " , " visionOS " ) ,
681- " SIMULATOR " : ( " targetEnvironment " , " simulator " ) ,
666+ private let targetOSNameMap : [ String : ExprSyntax ] = [
667+ " WINDOWS " : " os( Windows) " ,
668+ " LINUX " : " os( Linux) " ,
669+ " OSX " : " os( macOS) " ,
670+ " IOS " : " os( iOS) " ,
671+ " MACCATALYST " : " targetEnvironment( macCatalyst) " ,
672+ " TV " : " os( tvOS) " ,
673+ " WATCH " : " os( watchOS) " ,
674+ " VISION " : " os( visionOS) " ,
675+ " SIMULATOR " : " targetEnvironment( simulator) " ,
682676]
683677
684678extension IfConfigClauseSyntax {
0 commit comments