-
Notifications
You must be signed in to change notification settings - Fork 43
Open
Description
There is a hole allowing to initialize invalid NonEmptyString
let empty1: NonEmptyString = "" // crash π₯
let empty2 = NonEmptyString("") // crash π₯
let empty3: NonEmptyString = "\("")" // crash π₯
The problem seems to be with these conditional conformances:
extension NonEmpty: ExpressibleByStringLiteral where Collection: ExpressibleByStringLiteral
extension NonEmpty: ExpressibleByStringInterpolation where Collection: ExpressibleByStringInterpolation, Collection.StringLiteralType == DefaultStringInterpolation.StringLiteralType
The best approach I see for now is to remove these conformances and replace them with macro #NonEmptyString, which check at compile time.
Any ideas or plans about it?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels