kitlangton / kitlangton/stubby
`targetName` annotation is not picked up when using `stubbed`
- Dominant language
- Scala
- Stars
- 27
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
https://scastie.scala-lang.org/bUxsi5nPTi2Gm1o4SonRzQ
```scala
//> 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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked Scala 3.4.1 reproduction and the stubbed[Foo] entry point. Trace how the two @targetName annotations are handled when generating FooStubbed. Done means the example compiles without the duplicate-definition error and both overloaded methods remain distinguishable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100