-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
while it is possible to use @dynamicMemberLookup
with dynamically-looked-up static members, and while it is possible to use the implicit member syntax as a shorthand to omit the type when accessing a static member of a type, it is not possible to combine the two to implicitly access a dynamic member in a context where the expected type is known.
Reproduction
@dynamicMemberLookup
struct S {
static subscript(dynamicMember _: String) -> Self {
Self()
}
}
func f(_: S) {}
f(S.abc) // fine
f(.abc) // error: type 'S' has no member 'abc'
Expected behavior
the compiler should see that S
offers a dynamic member lookup for static members, and should treat f(.abc)
the same as f(S.abc)
Environment
swift-driver version: 1.127.14.1 Apple Swift version 6.2 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
Target: arm64-apple-macosx15.0
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.triage neededThis issue needs more specific labelsThis issue needs more specific labels