Skip to content

sbt doc fails on @typeclasses methods with scaladocs #90

@amirkarimi

Description

@amirkarimi

Supposing the following implementation:

package example

import simulacrum.typeclass

/**
  * My formatter
  *
  * @tparam A
  */
@typeclass trait Show[A] {
  /**
    * Formats the model
    * @param a
    * @return
    */
  def show(a: A): String
}

object Shows {
  implicit val intShow = new Show[Int] {
    override def show(a: Int) = a.toString
  }
}

object Hello extends App {
  import Shows._
  import Show.ops._

  println(1.show)
}

Build.sbt:

lazy val root = (project in file(".")).
  settings(
    inThisBuild(List(
      organization := "com.example",
      scalaVersion := "2.12.2",
      version      := "0.1.0-SNAPSHOT"
    )),
    name := "Hello",
    addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full),
    libraryDependencies ++= Seq(
      "com.github.mpilquist" %% "simulacrum" % "0.10.0"
    )
  )

It compiles successfully but running sbt doc will return the following error:

[error] .../simulacrum-doc-bug/src/main/scala/example/Hello.scala:29: value show is not a member of Int
[error]   println(1.show)
[error]             ^

It might have something to do with macro paradise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions