shapeless.Coproduct is imported but not used
See original GitHub issueGenerated code that uses Shapeless Coproduct includes this import:
import shapeless.{:+:, CNil, Coproduct}
However, it seems that the generated code doesn’t actually use shapeless.Coproduct
, which causes the following compiler error (I think if you have both -Xfatal-warnings
and -Ywarn-unused:imports
):
[error] /Users/foo/bar/target/scala-2.12/src_managed/test/compiled_avro/com/foo/Bar.scala:4: Unused import
[error] import shapeless.{:+:, CNil, Coproduct}
[error] ^
[error] one error found
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Coproducts in shapeless does not compile - Stack Overflow
I think you're looking for Inject : import shapeless._ import shapeless.ops.coproduct.Inject // for converter object import ...
Read more >Shapeless Coproducts | Toby Hobson
A type safe, composable alternative to sealed trait hierarchies.
Read more >milessabin/shapeless - Gitter
Hi. I've been playing with no-inheritance type modelling, with leaf types and using shapeless coproducts where I would otherwise have used a parent...
Read more >Type-safe error handling with Shapeless coproducts in Scala
Conclusion. We have looked at Shapeless coproducts and saw that it is a union type (e.g. it can return more than a single...
Read more >shapeless/ops/coproduct.scala - xuwei-k.github.com
See the License for the specific language governing permissions and * limitations under the License. */ package shapeless package ops import poly.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
shapeless.Coproduct
is used in the generated Scala file for default values.It would be great if the
shapeless.Coproduct
import could just be omitted when it is not used in the generated Scala.Hi @julianpeeters
When using a union of more than 2 types, using
sbt compile
, (plugin version 2.0.0), I’m getting this “unused import” error in the parent generated class.https://stackoverflow.com/questions/41478202/can-we-use-oneof-in-confluent-platform-schema-registry (the schema in the response works – also with 3 types in the union.)
The schema below doesn’t work, even though the avro schema is/seems valid:
Yielding:
I’m probably missing something here… but if it’s a bug, might you have a fix / workaround for this?