Jumhyn
(Frederick Kellison-Linn)
21
Yes, the toolchain on the PR should be fully-functional aside from an issue with code completion that still needs to be ironed out.
ETA: link (macOS)
rumnat
(Muratov Anton)
22
Feels naturally and as an extension that was supposed to be from the very beginning.
+1
I don’t have anything to comment on.
Great work! +1
blangmuir
(Ben Langmuir)
24
Got it. I'm not sure if it's worth changing, but the first bit of the detailed design seems like a much clearer explanation of this.
The general rule for code-completion is that we offer anything that is legal in the language, so I would expect code-completion to offer the members with other types that are now legal (but with lower priority compared to the ones matching the type). If we continued to constrain completion to only members matching the context type, it makes it hard for developers to use this new feature for heterogenously typed chains. E.g. if each of these has a different type, there would be no way to complete anything except the very last member
let _: D = .a.b.c.d
If we could restrict code-completion to only members for which there is a path to get to the context type (e.g. only show members of type T if T itself has members that can transitively reach the context type C), that would be better, but the extra cost of the analysis may be too high for code-completion.
2 Likes
Jumhyn
(Frederick Kellison-Linn)
25
That makes sense—I'll look into updating the code completion according to this behavior.
The behavior of the current implementation is marginally better than this—we don't offer the completion a, but b, c, and d all get offered and the respectively appropriate spots. It's just implicit member expressions that are artificially restricted to offer only options matching the contextual type. But after playing around with the completion I agree it's annoying to not get the completions for non-matching members offered when you're trying to start a heterogeneously-type chain.
1 Like
Strongly in favor of the proposal as written.
Yes
Yes, I’m surprised it doesn’t already work that way.
A quick read. It’s not complicated.
cprovatas
(Charlton Provatas)
27
+1 Would love to see this!
Zollerboy1
(Josef Zoller)
28
+1 for this feature. Fits the feeling of Swift very well and is a no-brainer in my opinion.
This proposal has been accepted, thank you everyone!
Doug
10 Likes