smithy4s
smithy4s copied to clipboard
Names of members of scala.Product, scala.Serializable should be escaped in case classes
There's probably more to this, but here's a minimal example of what's wrong:
namespace input
structure Hello {
productArity: String
}
Output:
[error] -- [E164] Declaration Error: /Users/kubukoz/projects/demos/target/scala-3.3.1/src_managed/main/scala/input/Hello.scala:10:23
[error] 10 |final case class Hello(productArity: Option[String] = None)
[error] | ^
[error] | error overriding method productArity in trait Product of type => Int;
[error] | value productArity of type Option[String] has incompatible type
[error] |
This will probably be similar to collisions with java.lang.Object methods: https://github.com/disneystreaming/smithy4s/commit/56a3cd09688f6c9cfd550ee03dcf504573e3fef1.
BTW this may be outright dangerous if you use anything that relies on productArity:
structure Hello {
@required productArity: Integer
}
because it actually does compile.
yeah, let's add those to the reserved words list, like we did for methods coming java.lang.Object