-
Notifications
You must be signed in to change notification settings - Fork 117
SourceLocation.init should enforce valid arguments #817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SourceLocation.init should enforce valid arguments #817
Conversation
@swift-ci please test |
@@ -51,21 +51,6 @@ struct SourceLocationTests { | |||
#expect(sourceLocation.fileName == "D.swift") | |||
} | |||
|
|||
|
|||
#if !SWT_NO_EXIT_TESTS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just moved this down without modification, to consolidate several exit tests together
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consider adding comments to all the precondition()
calls since they don't do source capture, e.g.:
precondition(line > 0, "SourceLocation.line must be greater than 0 (was \(line))")
@swift-ci please test |
@swift-ci please test |
This modifies
SourceLocation.init()
to addprecondition
s which enforce that its arguments are valid, matching preconditions in the corresponding properties.Modifications:
precondition
s to the initializer which match those indidSet
of the corresponding properties.Result:
Newly-added exit tests now pass.
Checklist: