sbt / contraband

http://www.scala-sbt.org/contraband/
Other
69 stars 22 forks source link

Some generated code does not compile with -Xfatal-warnings #149

Open eatkins opened 4 years ago

eatkins commented 4 years ago

I generated the following contraband file in sbt:

package sbt.internal

type MiniUpdateConfiguration {
  name: String!
  classpath: [java.io.File]
}
type MiniUpdateReport {
  configs: [MiniUpdateConfiguration]!
}

When I compile after running generateContrabands, I get the following error:

[error] ${BASE}/main/src/main/contraband-scala/sbt/internal/MiniUpdateReport.scala:22:26: private default argument in class MiniUpdateReport is never used                              
[error]   private[this] def copy(configs: Vector[MiniUpdateConfiguration] = configs): MiniUpdateReport = {

If I add another field to MiniUpdateReport, the warnings go away. It looks like maybe the generated code shouldn't use default arguments? I suppose that would require inlining the defaults everywhere in the various with* methods.

I can work around the issue but figured I should report it.