Commit Graph

7 Commits

Author SHA1 Message Date
Rintaro Ishizaki
78973173e9 [LookupVisibleDecls] Include protocol members when finding subscript(dynamicMember:)
struct Point { var x, y: Int }
  protocol P {}
  extension P {
    subscript<T>(dynamicMember key: KeyPath<Point, T>) -> T
  }
  @dynamicMemberLookup struct S: P {}

  S().<HERE>

Previously, completion couldn't suggest 'x' and 'y'. Include
'NL_ProtocolMembers' when finding 'subscript(dynamicMember:)'.

rdar://problem/71008072
2020-11-03 14:19:03 -08:00
Rintaro Ishizaki
9f02fa7b06 [CodeCompletion] Map the result type for keypath member lookup
rdar://problem/50073837
2019-06-24 12:34:31 -07:00
Ben Langmuir
636d63e609 [code-completion] Handle nested keypath dynamic lookup correctly
If the root type of the KeyPath also has dynamic member lookup, we need
to look through it.

rdar://problem/50450037
2019-05-13 14:32:33 -07:00
Ben Langmuir
6c29502bc8 Fix test comment about expected behaviour 2019-05-06 13:13:04 -07:00
Ben Langmuir
8f38e4b765 [code-completion] Avoid invalid member substitution for keypath dynamic lookup
When performing keypath dynamic member lookup, avoid substituting the
base type in override detection and completion, as the base type of the
lookup is not the base type of the member. For now, we just avoid the
substitution entirely to fix potential crashes; in a future commit we
will change to using the subscript return type and substituting with the
base type of the subscript instead of the base type of the lookup.

rdar://50449788
2019-05-06 10:02:39 -07:00
Ben Langmuir
ae4827a437 [code-completion] Avoid name copy for non dynamic member types
Per review feedback. Also add some test cases that should fail dynamic
member lookup.
2019-04-17 09:50:24 -07:00
Ben Langmuir
8d4447c1d7 [code-completion] Add completion for keypath dynamic member lookup
Looks into the root type of the keypath to find additional members. This
does not currently map the type of the completion to the subscript's
return type.

rdar://49029126
2019-04-16 15:37:32 -07:00