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
Use the package access level instead of @testable imports
`@testable` imports have a number of build-time drawbacks, including:
- Building the package in `release` configuration and then running tests requires the entire package to be rebuilt because SwiftPM needs to pass `--enable-testing` to the compiler invocations.
- The usage of `@testable` means that swift-foundation cannot be included in the unified (aka. multiroot) build of all the other packages in Swift CI, which means that it needs to re-build swift-syntax, unnecessarily increasing CI time.
To fix this, make all `@testable` imports normal imports and mark the declarations that were previously accessed through `@testable` as `package`.
func dateComponent(_ component:Calendar.Component, from date:Date)->Int{
2139
+
packagefunc dateComponent(_ component:Calendar.Component, from date:Date)->Int{
2140
2140
guardlet value =dateComponents(.init(single: component), from: date, in: timeZone).value(for: component)else{
2141
2141
preconditionFailure("dateComponents(:from:in:) unexpectedly returns nil for requested component")
2142
2142
}
@@ -2227,7 +2227,7 @@ internal final class _CalendarGregorian: _CalendarProtocol, @unchecked Sendable
2227
2227
returnnil
2228
2228
}
2229
2229
2230
-
func add(_ field:Calendar.Component, to date:Date, amount:Int, inTimeZone timeZone:TimeZone)throws(GregorianCalendarError)->Date{
2230
+
packagefunc add(_ field:Calendar.Component, to date:Date, amount:Int, inTimeZone timeZone:TimeZone)throws(GregorianCalendarError)->Date{
2231
2231
2232
2232
guard amount !=0else{
2233
2233
return date
@@ -2406,7 +2406,7 @@ internal final class _CalendarGregorian: _CalendarProtocol, @unchecked Sendable
2406
2406
return newValue
2407
2407
}
2408
2408
2409
-
func addAndWrap(_ field:Calendar.Component, to date:Date, amount:Int, inTimeZone timeZone:TimeZone)throws(GregorianCalendarError)->Date{
2409
+
packagefunc addAndWrap(_ field:Calendar.Component, to date:Date, amount:Int, inTimeZone timeZone:TimeZone)throws(GregorianCalendarError)->Date{
2410
2410
2411
2411
guard amount !=0else{
2412
2412
return date
@@ -2851,7 +2851,7 @@ internal final class _CalendarGregorian: _CalendarProtocol, @unchecked Sendable
2851
2851
return result
2852
2852
}
2853
2853
2854
-
func date(byAdding components:DateComponents, to date:Date, wrappingComponents:Bool)->Date?{
2854
+
packagefunc date(byAdding components:DateComponents, to date:Date, wrappingComponents:Bool)->Date?{
2855
2855
do{
2856
2856
if wrappingComponents {
2857
2857
returntryself.date(byAddingAndWrapping: components, to: date)
@@ -2866,7 +2866,7 @@ internal final class _CalendarGregorian: _CalendarProtocol, @unchecked Sendable
2866
2866
// MARK: Differences
2867
2867
2868
2868
// Calendar::fieldDifference
2869
-
func difference(inComponent component:Calendar.Component, from start:Date, to end:Date)throws(GregorianCalendarError)->(difference:Int, newStart:Date){
2869
+
packagefunc difference(inComponent component:Calendar.Component, from start:Date, to end:Date)throws(GregorianCalendarError)->(difference:Int, newStart:Date){
2870
2870
guard end != start else{
2871
2871
return(0, start)
2872
2872
}
@@ -2944,7 +2944,7 @@ internal final class _CalendarGregorian: _CalendarProtocol, @unchecked Sendable
2944
2944
}
2945
2945
2946
2946
2947
-
func dateComponents(_ components:Calendar.ComponentSet, from start:Date, to end:Date)->DateComponents{
2947
+
packagefunc dateComponents(_ components:Calendar.ComponentSet, from start:Date, to end:Date)->DateComponents{
0 commit comments