Open kubukoz opened 6 months ago
uh, I tried prefixing everything with _root_
and it's quite a bit:
plus, I could've missed a string or two because they're kinda all over the place (which we could actually centralize as part of this fix)
before I go and commit to this, I'll need to know if we're all fine with such a solution, or whether we want to do anything smarter than that.
I would suggest that we stick to this - if we were to e.g. only prefix _root_
when there's a conflict, I'm pretty sure we'd have to know about not only all the present namespaces, but also the entire compile-time classpath of the module we're generating in. And that's very build-tool-specific.
I'll need to know if we're all fine with such a solution, or whether we want to do anything smarter than that.
Here's what I think :
_root_
prepending to here, provided we amend the rendering of hints to also use NameRef
. Sounds good. Should it be configured by smithy metadata?
@kubukoz yeah preferably so
Possible (temporary?) workaround: rename the shapes before codegenning.
it'd still be good to implement this though
Consider this smithy:
It works fine. However, if you add another file:
then the first one's Scala no longer compiles:
it actually gets easier to understand if both types are named
Long
:because then the message says:
I think this would have to be solved by referring to
_root_.scala.Long
.BTW I swear I didn't make this case up, I was just trying to generate code for BSP 😅 Long actually exists, and so does the relative
.scala
namespace.