You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Traits] Only allow valid Swift identifiers (#8178)
# Motivation
During the proposal review it was brought up that the rules around trait
names wasn't inline with Swift identifiers. Neither was the
implementation which was inline with the proposal.
# Modification
This PR changes our validation logic to only allow valid Swift
identifiers.
# Result
Only allows trait names that can be used as Swift identifiers.
.error("Invalid first character (\(firstCharater)) in trait \(trait). The first character must be a Unicode XID start character (most letters), a digit, or _.")
XCTAssertEqual(firstDiagnostic.message,"Invalid first character (\(traitName.first!)) in trait \(traitName). The first character must be a Unicode XID start character (most letters), a digit, or _.")
116
+
XCTAssertEqual(firstDiagnostic.message,"Invalid trait name \(traitName). Trait names must be valid Swift identifiers")
118
117
}
119
118
}
120
119
@@ -129,7 +128,6 @@ final class TraitLoadingTests: PackageDescriptionLoadingTests {
0 commit comments