Skip to content

Commit 8f025cc

Browse files
authored
Fix #filePath related warnings (#985)
#635 caused new warnings: ``` warning: parameter 'file' with default argument '#filePath' passed to parameter 'file', whose default argument is '#file' ``` This is because standard library's assertion and error functions use `#file`. Also fix a few other trivial warnings.
1 parent 9466eb9 commit 8f025cc

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

Sources/DistributedActors/Behaviors.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ extension _Behavior {
599599
///
600600
/// Note: The returned behavior MUST be `_Behavior.canonicalize`-ed in the vast majority of cases.
601601
// Implementation note: We don't do so here automatically in order to keep interpretations transparent and testable.
602-
public func interpretMessage(context: _ActorContext<Message>, message: Message, file: StaticString = #filePath, line: UInt = #line) throws -> _Behavior<Message> {
602+
public func interpretMessage(context: _ActorContext<Message>, message: Message, file: StaticString = #file, line: UInt = #line) throws -> _Behavior<Message> {
603603
switch self.underlying {
604604
case .receiveMessage(let recv): return try recv(message)
605605
case .receiveMessageAsync(let recv): return self.receiveMessageAsync(recv, message)

Sources/DistributedActors/Cluster/DistributedNodeDeathWatcher.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ internal actor DistributedNodeDeathWatcher {
4848
private var eventListenerTask: Task<Void, Error>?
4949

5050
init(actorSystem: ActorSystem) async {
51-
var log = actorSystem.log
51+
let log = actorSystem.log
5252
self.log = log
5353
self.selfNode = actorSystem.cluster.uniqueNode
5454
// initialized

Sources/DistributedActors/ClusterSystem.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,7 @@ extension ClusterSystem {
912912
} else {
913913
lifecycleContainer = nil
914914
}
915-
traceLog_DeathWatch("Make LifecycleWatchContainer for \(id):::: \(lifecycleContainer)")
915+
traceLog_DeathWatch("Make LifecycleWatchContainer for \(id):::: \(optional: lifecycleContainer)")
916916

917917
id.context = .init(lifecycle: lifecycleContainer)
918918

@@ -1066,7 +1066,7 @@ extension ClusterSystem {
10661066

10671067
let timeout = RemoteCall.timeout ?? self.settings.defaultRemoteCallTimeout
10681068
let timeoutTask: Task<Void, Error> = Task.detached {
1069-
await Task.sleep(UInt64(timeout.nanoseconds))
1069+
try await Task.sleep(nanoseconds: UInt64(timeout.nanoseconds))
10701070
guard !Task.isCancelled else {
10711071
return
10721072
}

Sources/DistributedActors/DistributedActorContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public final class DistributedActorContext {
2424

2525
init(lifecycle: LifecycleWatchContainer?) {
2626
self.lifecycle = lifecycle
27-
traceLog_DeathWatch("Create context; Lifecycle: \(lifecycle)")
27+
traceLog_DeathWatch("Create context; Lifecycle: \(optional: lifecycle)")
2828
}
2929

3030
/// Invoked by the actor system when the owning actor is terminating, so we can clean up all stored data

Sources/DistributedActors/utils.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,32 +41,32 @@ import Foundation
4141
*
4242
* Originally from: Johannes Weiss (MIT licensed) https://github.com/weissi/swift-undefined
4343
*/
44-
public func _undefined<T>(hint: String = "", function: StaticString = #function, file: StaticString = #filePath, line: UInt = #line) -> T {
44+
public func _undefined<T>(hint: String = "", function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> T {
4545
let message = hint == "" ? "" : ": \(hint)"
4646
fatalError("undefined \(function) -> \(T.self)\(message)", file: file, line: line)
4747
}
4848

49-
public func _undefined(hint: String = "", function: StaticString = #function, file: StaticString = #filePath, line: UInt = #line) -> Never {
49+
public func _undefined(hint: String = "", function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> Never {
5050
let message = hint == "" ? "" : ": \(hint)"
5151
fatalError("undefined \(function) -> Never \(message)", file: file, line: line)
5252
}
5353

54-
func TODO<T>(_ hint: String, function: StaticString = #function, file: StaticString = #filePath, line: UInt = #line) -> T {
54+
func TODO<T>(_ hint: String, function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> T {
5555
fatalError("TODO(\(function)): \(hint)", file: file, line: line)
5656
}
5757

58-
func FIXME<T>(_ hint: String, function: StaticString = #function, file: StaticString = #filePath, line: UInt = #line) -> T {
58+
func FIXME<T>(_ hint: String, function: StaticString = #function, file: StaticString = #file, line: UInt = #line) -> T {
5959
fatalError("TODO(\(function)): \(hint)", file: file, line: line)
6060
}
6161

6262
// TODO: Remove this once we're happy with swift-backtrace always printing backtrace (also on macos)
6363
@usableFromInline
64-
internal func fatalErrorBacktrace<T>(_ hint: String, file: StaticString = #filePath, line: UInt = #line) -> T {
64+
internal func fatalErrorBacktrace<T>(_ hint: String, file: StaticString = #file, line: UInt = #line) -> T {
6565
sact_dump_backtrace()
6666
fatalError(hint, file: file, line: line)
6767
}
6868

69-
internal func assertBacktrace(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = String(), file: StaticString = #filePath, line: UInt = #line) {
69+
internal func assertBacktrace(_ condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = String(), file: StaticString = #file, line: UInt = #line) {
7070
assert(condition(), { () in sact_dump_backtrace(); return message() }(), file: file, line: line)
7171
}
7272

Tests/DistributedActorsTests/Cluster/TestExtensions+MembershipDSL.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ extension Cluster.MembershipGossip {
3333
extension Cluster.MembershipGossip.SeenTable {
3434
/// Express seen tables using a DSL
3535
/// Syntax: each line: `<owner>: <node>@<version>*`
36-
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #filePath, line: UInt = #line) -> Cluster.MembershipGossip.SeenTable {
36+
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #file, line: UInt = #line) -> Cluster.MembershipGossip.SeenTable {
3737
let lines = dslString.split(separator: "\n")
3838
func nodeById(id: String.SubSequence) -> UniqueNode {
3939
if let found = nodes.first(where: { $0.node.systemName.contains(id) }) {
@@ -71,7 +71,7 @@ extension Cluster.MembershipGossip.SeenTable {
7171
}
7272

7373
extension VersionVector {
74-
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #filePath, line: UInt = #line) -> VersionVector {
74+
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #file, line: UInt = #line) -> VersionVector {
7575
func nodeById(id: String.SubSequence) -> UniqueNode {
7676
if let found = nodes.first(where: { $0.node.systemName.contains(id) }) {
7777
return found
@@ -96,7 +96,7 @@ extension Cluster.Membership {
9696
/// ```
9797
/// <node identifier>[.:]<node status> || [leader:<node identifier>]
9898
/// ```
99-
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #filePath, line: UInt = #line) -> Cluster.Membership {
99+
static func parse(_ dslString: String, nodes: [UniqueNode], file: StaticString = #file, line: UInt = #line) -> Cluster.Membership {
100100
func nodeById(id: String.SubSequence) -> UniqueNode {
101101
if let found = nodes.first(where: { $0.node.systemName.contains(id) }) {
102102
return found

0 commit comments

Comments
 (0)