Skip to content

[SR-13086] Code completion for KeyPath-based @dynamicMemberLookup #55532

Open
@belkadan

Description

@belkadan
Previous ID SR-13086
Radar None
Original Reporter @belkadan
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s CodeCompletion
Labels Improvement
Assignee None
Priority Medium

md5: e4a61b5548653332509db6b87bfff95c

Issue Description:

SE-0252 added support for key-path-based dynamic member lookup, but code completion doesn't show any of those members.

@dynamicMemberLookup
struct PointlessWrapper<T> {
  var value: T

  subscript<U>(dynamicMember keyPath: WritableKeyPath<T, U>) -> PointlessWrapper <U> {
    return PointlessWrapper<U>(value: self.value[keyPath: keyPath])
  }
}

struct Point {
  var x, y: Double
}

let wrapper = PointlessWrapper<Point>(value: Point(x: 0, y: 0))
let wrapperX = wrapper. // complete here

Metadata

Metadata

Assignees

No one assigned

    Labels

    @dynamicMemberLookupFeature → attributes: the @dynamicMemberLookup attributeattributesFeature: Declaration and type attributescode completionArea → source tooling: code completionimprovementsource toolingArea: IDE support, SourceKit, and other source tooling

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions