Skip to content

Commit dfd4206

Browse files
committed
Work around a retroactive conformance bug in Swift 6.2.
The Swift 6.2 compiler emits spurious warnings about retroactive conformances to protocols that are inherited through a protocol that is written module qualified in the inheritance clause. Suppress the warnings by making the inherited conformances explicit and module qualified.
1 parent ef033f4 commit dfd4206

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

CodeGeneration/Sources/generate-swift-syntax/templates/swiftsyntaxbuilder/SyntaxExpressibleByStringInterpolationConformancesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let syntaxExpressibleByStringInterpolationConformancesFile = SourceFileSyntax(le
3535
DeclSyntax(
3636
"""
3737
#if compiler(>=6)
38-
extension \(type): Swift.ExpressibleByStringInterpolation {}
38+
extension \(type): Swift.ExpressibleByStringInterpolation, Swift.ExpressibleByStringLiteral, Swift.ExpressibleByExtendedGraphemeClusterLiteral, Swift.ExpressibleByUnicodeScalarLiteral {}
3939
#endif
4040
"""
4141
)

Sources/SwiftSyntaxBuilder/Syntax+StringInterpolation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ extension TokenSyntax: SyntaxExpressibleByStringInterpolation {
466466
#if compiler(>=6)
467467
// Silence warning that TokenSyntax has a retroactive conformance to `ExpressibleByStringInterpolation` through
468468
// `SyntaxExpressibleByStringInterpolation`.
469-
extension TokenSyntax: Swift.ExpressibleByStringInterpolation {}
469+
extension TokenSyntax: Swift.ExpressibleByStringInterpolation, Swift.ExpressibleByStringLiteral, Swift.ExpressibleByExtendedGraphemeClusterLiteral, Swift.ExpressibleByUnicodeScalarLiteral {}
470470
#endif
471471

472472
// MARK: - Trivia expressible as string
@@ -515,7 +515,7 @@ extension Trivia {
515515
}
516516

517517
#if compiler(>=6)
518-
extension Trivia: Swift.ExpressibleByStringInterpolation {}
518+
extension Trivia: Swift.ExpressibleByStringInterpolation, Swift.ExpressibleByStringLiteral, Swift.ExpressibleByExtendedGraphemeClusterLiteral, Swift.ExpressibleByUnicodeScalarLiteral {}
519519
#else
520520
extension Trivia: ExpressibleByStringInterpolation {}
521521
#endif

Sources/SwiftSyntaxBuilder/generated/SyntaxExpressibleByStringInterpolationConformances.swift

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)