simulacrum icon indicating copy to clipboard operation
simulacrum copied to clipboard

Some generated public members don't have explicit return types

Open ceedubs opened this issue 7 years ago • 0 comments

Currently annotating a type with @typeclass generates members that don't have explicit return types. This conflicts with the Wart.PublicInference WartRemover rule.

You can see this issue with the simulacrum library by making adding this wart to build.sbt (see diff below). This results in a bunch of errors similar to the following:

src/test/scala/simulacrum/examples/examples.scala:13:8: [wartremover:PublicInference] Public member must have an explicit type ascription
[error]       @typeclass trait Semigroup[A] {                                                                                                                                                
[error]        ^
diff --git a/build.sbt b/build.sbt
index 7f9479d..2e50f40 100644
--- a/build.sbt
+++ b/build.sbt
@@ -85,7 +85,8 @@ lazy val commonSettings = Seq(
   useGpgAgent := true,
   wartremoverErrors in (Test, compile) ++= Seq(
     Wart.ExplicitImplicitTypes,
-    Wart.ImplicitConversion)
+    Wart.ImplicitConversion,
+    Wart.PublicInference)
 ) ++ Seq(Compile, Test).map{ scope =>
   scalacOptions in (scope, compile) := {
     CrossVersion.partialVersion(scalaVersion.value) match {

ceedubs avatar Apr 04 '18 22:04 ceedubs