Skip to content

Dynamic member lookup subscript should support file:line: default parameters #59706

Open
@stephencelis

Description

@stephencelis

Is your feature request related to a problem? Please describe.

Dynamic member lookup subscript should support file:line: default parameters. Knowing the calling context of the lookup can be important for surfacing where the source origin of a problem is.

Describe the solution you'd like

The following code should compile:

@dynamicMemberLookup
struct S<T> {
  var wrappedValue: T
  subscript<U>(
    dynamicMember keyPath: KeyPath<T, U>
    // Comment the next line out and all is well.
    , file: StaticString = #file, line: UInt = #line
  ) -> U {
    self.wrappedValue[keyPath: keyPath]
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    @dynamicMemberLookupFeature → attributes: the @dynamicMemberLookup attributeattributesFeature: Declaration and type attributescompilerThe Swift compiler itselfdefault argumentsFeature: default arguments for value parametersfeatureA feature request or implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions