kitlangton / stubby

A simple stubbing library for ZIO tests.
15 stars 2 forks source link

`targetName` annotation is not picked up when using `stubbed` #1

Open yoohaemin opened 3 weeks ago

yoohaemin commented 3 weeks ago

https://scastie.scala-lang.org/bUxsi5nPTi2Gm1o4SonRzQ

//> using dep io.github.kitlangton::stubby:0.1.2

import scala.annotation.*
import stubby.*

trait Foo {

  @targetName("a1")
  def a(i: Int): Unit

  @targetName("a2")
  def a(i: Int): Unit

}

stubbed[Foo] // Not OK
$ scala-cli a.sc
Compiling project (Scala 3.4.1, JVM (21))
[error] ./a.sc:16:1
[error] Double definition:
[error] def a(i: Int): Unit in class FooStubbed and
[error] def a(i: Int): Unit in class FooStubbed
[error] have the same type after erasure.
[error] 
[error] Consider adding a @targetName annotation to one of the conflicting definitions
[error] for disambiguation.
[error] stubbed[Foo] // Not OK
[error] ^^^^^^^^^^^^
Error compiling project (Scala 3.4.1, JVM (21))
Compilation failed
kitlangton commented 3 weeks ago

Ah yes. I should duplicate annotations 😄 Thanks for the report!