-
Notifications
You must be signed in to change notification settings - Fork 4
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
NoModuleOnExposedName fix can introduce name collision #36
Comments
Ooo that's an interesting case there. I don't think this rule should be responsible for fixing your |
To be clear, I think the second example shouldn't be an error at all due to there being no good way to fix it. I agree the first example should just not have an auto-fix though. |
There are a number of 'good' ways the second can be fixed... the author could choose not to expose the Subcomponent's Msg variants and fully qualify all their subcomponent use or they could choose to rename the local What happens if the author decides to add Personally, I'm not a fan of imports exposing type constructors because it makes it much harder (even than normal imports) to figure out where things are coming from. |
I agree with @sparksp that there are multiple ways to fix the issue, qualified imports of the constructors being one of them. But I think that the original example as it is is just fine too and that there is not a lot of ways the situation can be improved upon without potentially a lot of (manual) renaming. I therefore think the rule should not report an error in the case where the imported type is the same as a local type (and probably the same thing for values?). |
@sparksp Fair enough, I guess I'm okay with it showing an error but not an auto-fix in the second example as well. That said, if it is an error and you're feeling particularly motivated, maybe |
Ran into this situation as well, today. Seems like folks have settled on "Don't report an error" in this case. Has anyone made any progress on adding that behavior to the rule? |
In the following rule, NoModuleOnExposedName will suggest a fix by replacing
convert : Color -> Element.Color
withconvert : Color -> Color
which will lead to a compile error. It should instead suggest removing Color from exposing or not suggest any fix in this case.Edit: I think the correct behavior would be to not show an error at all. Consider this case:
Subcomponent.Msg
can't be changed toMsg
due to a name collision butexposing (Msg(..))
can't be removed either because ofMsgVariantInSubComponent
.The text was updated successfully, but these errors were encountered: