[Distributed] Fix effectiveLabel implemementation to expected semantics

This commit is contained in:
Konrad `ktoso` Malawski
2023-10-10 22:44:42 +09:00
parent 042ccdda01
commit 1d150c811c
2 changed files with 238 additions and 4 deletions

View File

@@ -790,11 +790,20 @@ public struct RemoteCallArgument<Value> {
/// the user-visible name of this argument.
public let label: String?
/// The effective label of this argument, i.e. if no explicit `label` was set
/// this defaults to the `name`. This reflects the semantics of call sites of
/// function declarations without explicit label definitions in Swift.
/// The effective label of this argument. This reflects the semantics
/// of call sites of function declarations without explicit label
/// definitions in Swift.
///
/// For example, for a method declared like `func hi(a: String)` the effective
/// label is `a` while for a method like `func hi(a b: String)` or
/// `func hi(_ b: String)` the label is the explicitly declared one,
/// so `a` and `_` respectively.
public var effectiveLabel: String {
return label ?? name
if let label {
return label
} else {
return "_"
}
}
/// The internal name of parameter this argument is accessible as in the