-
Notifications
You must be signed in to change notification settings - Fork 49
Add missing imports of _RegexParser
#763
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
Add missing imports of _RegexParser
#763
Conversation
@swift-ci please test |
@@ -9,8 +9,8 @@ | |||
// | |||
//===----------------------------------------------------------------------===// | |||
|
|||
@_spi(_Unicode) | |||
import Swift | |||
@_spi(_Unicode) import Swift |
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'd prefer the attribute to appear on a newline above the import.
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.
Ok. How do you see this style mixing with multiple imports in the same file? To me this looked rather unusual and made it hard to scan the block of imports. I could also add a newline before internal import _RegexParser
but that too looks unusual.
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.
My personal preference for attributes is always above the declaration it's attributing to. In the standard library for functions we have:
@available(SwiftStdlib 6.0, *)
func something() {
}
right, and for property wrappers my preference is also above the property declaration:
struct A {
@propertyWrapper
let b: Int
let c: String
}
I think the newline before the 2nd property here makes sense to me and would similarly apply it to imports:
@attribute
import Swift
import A
import B
But again, this is just personal preference. I don't think we have a defined style yet for this because we just simply don't write imports with attributes often at all.
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 generally agree that attributes belong above declarations, especially when the list of attributes is likely to grow and line lengths can become an issue. For whatever reason, though, vibes-wise I don't think of imports
as following the same rules as other declarations because it's so common for there to be an uninterrupted block of them at the top of a file. @_spi
on a separate line really sticks out like a sore thumb to me, never seen it outside of this codebase. I'll follow your recommendation here, though, as I agree it seems to be the most consistent rule.
While experimenting with adopting the `MemberImportVisibility` experimental feature (SE-0444) in the standard library build, I found that the `_StringProcessing` module was relying on transitive imports of `_RegexParser` in many source files.
3449927
to
f6e4f7e
Compare
@swift-ci please test |
While experimenting with adopting the
MemberImportVisibility
experimental feature (SE-0444) in the standard library build, I found that the_StringProcessing
module was relying on transitive imports of_RegexParser
in many source files.