-
-
Notifications
You must be signed in to change notification settings - Fork 604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in "type.implements"? #51
Comments
By playing a little bit with the Sourcery code I discovered that the T1 definition doesn't contain the
(see last variable) Maybe EDIT: after some other investigation I discovered that The weird thing though is that the behaviour is different in |
Here is how these collections work:
@krzysztofzablocki to be honest I'm starting to think that my original proposal to distinguish inherited/implementing types was not that good and creates confusion, looks like having just one |
If I can give my opinion, it is very very hard to understand from the user point of view (*). This division seems more related to Sourcery internals than how people (but here I have just one example, myself) would think about it. I think that it would be amazing to just have If a protocol/class is not known (that is, you can't know which types are carried by that protocol/class) then of course you won't have some information, but I guess here there is very little Sourcery can do without adding Apple frameworks metadata. (*) Maybe it is just because the lack of examples/documentation. I'm thinking how to improve it. if I find a good idea, I will send a PR |
there is one bug when it doesn't properly propagate protocols when one protocol implements another, but I've already fixed it, will push it when I get better network reception (on train atm). @ilyapuchka I had inherited, implementing already and symmetry here is in order so we shouldn't change it. I'm removing @bolismauro if you don't care whether is known or not, then you can use |
Actually since structs and enums can't inherit we can infer that the inheritedTypes are in fact protocols and we could create their definitions internally, what do you guys think about this? @bolismauro ? @ilyapuchka do you think if I added that it would made sense? or would it break the idea of 'Known types' |
I also started to think about creating At this point I still would say that the best way to avoid confusion here is to keep only one collection of types, name it |
Yeah that's my thought it's going to cause more confusion, I'd leave the implementation as it is, and add examples to docs, in this task using |
Yes, using |
ok closing then, hope our reasoning makes sense to you @bolismauro, but let us know if anything is unclear, I should have a fix for protocol implementing other protocols in ~2h when I get home |
I was thinking something similar. Something like
But I trust you if you think that it will cause more confusion. I have tried just 2/3 use cases and maybe the changes I'm suggesting make sense only in very few cases :) Thanks again! |
Let's keep it simple for now and see if we find more use-cases, if we saw a |
|
I'm trying the feature implemented in #42 (as requested in #41)
This is my code
with this condition, the
T1
struct is ignoredwhile with this one, it works:
If I print the types,
inheritedTypes
values have the expected content (soAutoEquatable
for T and T2, andEquatable
forT1
). It seems a bug in theimplements
"function".If this is the desired behaviour, I think it is confusing (right now, maybe there is a good reason I don't see :) )
The text was updated successfully, but these errors were encountered: