Skip to content

Commit e2f1076

Browse files
authored
Use #fileID instead of #file (#70)
1 parent 5c56e8d commit e2f1076

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
internal struct SourceLocation: Equatable {
22
let fileID: String
33
let line: UInt
4+
5+
init(fileID: String = #fileID, line: UInt = #line) {
6+
self.fileID = fileID
7+
self.line = line
8+
}
49
}

Tests/AtomsTests/Core/StoreContextTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ final class StoreContextTests: XCTestCase {
108108
store.state.caches[key] = AtomCache(atom: atom, value: 0)
109109
store.state.states[key] = AtomState(coordinator: atom.makeCoordinator())
110110
store.state.subscriptions[key, default: [:]][subscriptionKey] = Subscription(
111-
location: SourceLocation(fileID: #file, line: #line),
111+
location: SourceLocation(),
112112
requiresObjectUpdate: false,
113113
notifyUpdate: { updateCount += 1 },
114114
unsubscribe: {}
@@ -147,7 +147,7 @@ final class StoreContextTests: XCTestCase {
147147
store.state.caches[key] = AtomCache(atom: atom, value: 0)
148148
store.state.states[key] = AtomState(coordinator: atom.makeCoordinator())
149149
store.state.subscriptions[key, default: [:]][subscriptionKey] = Subscription(
150-
location: SourceLocation(fileID: #file, line: #line),
150+
location: SourceLocation(),
151151
requiresObjectUpdate: false,
152152
notifyUpdate: { updateCount += 1 },
153153
unsubscribe: {}
@@ -303,7 +303,7 @@ final class StoreContextTests: XCTestCase {
303303
key0: AtomCache(atom: atom0, value: 0),
304304
key1: AtomCache(atom: atom1, value: 1),
305305
]
306-
let subscription = Subscription(location: SourceLocation(fileID: #file, line: #line), requiresObjectUpdate: false, notifyUpdate: {}) {}
306+
let subscription = Subscription(location: SourceLocation(), requiresObjectUpdate: false, notifyUpdate: {}) {}
307307

308308
store.graph = graph
309309
store.state.caches = caches
@@ -836,7 +836,7 @@ final class StoreContextTests: XCTestCase {
836836
let atom0 = TestAtom(value: 0)
837837
let atom1 = TestAtom(value: 1)
838838
let atom2 = TestAtom(value: 2)
839-
let location = SourceLocation(fileID: #file, line: #line)
839+
let location = SourceLocation()
840840
let token = SubscriptionKey.Token()
841841
let subscriptionKey = SubscriptionKey(token: token)
842842

Tests/AtomsTests/Core/SubscriptionContainerTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ final class SubscriptionContainerTests: XCTestCase {
88
var container: SubscriptionContainer? = SubscriptionContainer()
99
var unsubscribedCount = 0
1010
let subscription = Subscription(
11-
location: SourceLocation(fileID: #file, line: #line),
11+
location: SourceLocation(),
1212
requiresObjectUpdate: false,
1313
notifyUpdate: {}
1414
) {
@@ -28,7 +28,7 @@ final class SubscriptionContainerTests: XCTestCase {
2828
}
2929

3030
func testWrapper() {
31-
let location = SourceLocation(fileID: #file, line: #line)
31+
let location = SourceLocation()
3232
let container0 = SubscriptionContainer()
3333
let container1 = container0
3434
let container2 = SubscriptionContainer()

Tests/AtomsTests/Utilities/Util.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ extension AtomKey {
6565

6666
extension SubscriptionContainer {
6767
var wrapper: Wrapper {
68-
let location = SourceLocation(fileID: #fileID, line: #line)
68+
let location = SourceLocation()
6969
return wrapper(location: location)
7070
}
7171
}

0 commit comments

Comments
 (0)