Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@op annotation causing compilation error on 2.13.1 #173

Open
hicolour opened this issue Jan 10, 2020 · 0 comments
Open

@op annotation causing compilation error on 2.13.1 #173

hicolour opened this issue Jan 10, 2020 · 0 comments

Comments

@hicolour
Copy link

@op annotation causing compilation error on 2.13.1
@typeclass works perfectly fine

Reference project hicolour/simulacrum-2.13-op

Reference build:

sbt.version=1.3.6

lazy val root = (project in file("."))
  .settings(
    name := "simulacrum-2.13-op",
    organization := "com.prochera",
    version := "0.1",
    libraryDependencies ++= Seq(
      "org.typelevel"        %% "simulacrum" % "1.0.0",
    ),
    scalaVersion := "2.13.1",
    scalacOptions ++= List(
      "-unchecked",
      "-deprecation",
      "-Ymacro-annotations",
      "-language:higherKinds",
      "-language:implicitConversions"
    )
  )

Fail with @op annotation

  import simulacrum._

  @typeclass trait Semigroup[A] {
    @op("|+|") def append(x: A, y: A): A
  }
simulacrum-2.13-op/src/main/scala/OpAnnotationException.scala:5:4: exception during macro expansion: 
[error] scala.reflect.macros.TypecheckException: not found: type op
[error]         at scala.reflect.macros.contexts.Typers.$anonfun$typecheck$3(Typers.scala:44)
[error]         at scala.reflect.macros.contexts.Typers.$anonfun$typecheck$2(Typers.scala:38)
[error]         at scala.reflect.macros.contexts.Typers.doTypecheck$1(Typers.scala:37)
[error]         at scala.reflect.macros.contexts.Typers.$anonfun$typecheck$7(Typers.scala:50)
[error]         at scala.reflect.internal.Trees.wrappingIntoTerm(Trees.scala:1866)
[error]         at scala.reflect.internal.Trees.wrappingIntoTerm$(Trees.scala:1863)
[error]         at scala.reflect.internal.SymbolTable.wrappingIntoTerm(SymbolTable.scala:28)
[error]         at scala.reflect.macros.contexts.Typers.typecheck(Typers.scala:50)
[error]         at scala.reflect.macros.contexts.Typers.typecheck$(Typers.scala:32)
[error]         at scala.reflect.macros.contexts.Context.typecheck(Context.scala:18)
[error]         at scala.reflect.macros.contexts.Context.typecheck(Context.scala:18)
[error]         at simulacrum.TypeClassMacros.$anonfun$generateTypeClass$5(typeclass.scala:142)
[error]         at simulacrum.TypeClassMacros.$anonfun$generateTypeClass$5$adapted(typeclass.scala:141)
[error]         at scala.collection.immutable.List.filter(List.scala:487)
[error]         at simulacrum.TypeClassMacros.filterSimulacrumAnnotations$1(typeclass.scala:141)
[error]         at simulacrum.TypeClassMacros.$anonfun$generateTypeClass$65(typeclass.scala:453)
[error]         at scala.collection.immutable.List.map(List.scala:219)
[error]         at simulacrum.TypeClassMacros.modify$1(typeclass.scala:451)
[error]         at simulacrum.TypeClassMacros.generateTypeClass(typeclass.scala:493)
[error]   @typeclass trait Semigroup[A] {
[error]    ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed

Compile without @op

  import simulacrum._

  @typeclass trait Semigroup[A] {
    def append(x: A, y: A): A
  }
[success] Total time: 0 s, completed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant