Open xAlien95 opened 4 years ago
@swift-ci create
Fwiw, I agree with your point; the two types are different and conflating them is not the way to go. Maybe it looks cleaner, but it's conceptually incorrect, which is a negative for something that is presented frequently to a developer.
https://forums.swift.org/t/should-the-type-double-string-be-never/40908/12
The link above describes a real-world situation in which the current behavior actively misled a user to believe that they were using an existential type when they were not. Given the pervasive misunderstanding of existentials and generics, this sort of mixup is, arguably, actively confusing users and steering them into the wrong path.
Attachment: Download
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | SourceKit-LSP | |Labels | Improvement | |Assignee | None | |Priority | Medium | md5: 082a2c11b6e53a2c078c70bdfa52294aIssue Description:
Currently, when typing
max
you getas a suggested type signature, which may led the user into thinking that the function accepts existential protocol types instead of a unique type "
T: Comparable"
in both the arguments and result (see attached image,P1
andP2
are protocols,C1
is a class).It may be more useful to show
as suggested type signature, although less readable.
We have the same issue when typing in the function body: