softwaremill / softwaremill/macwire
Used variable for instantiation differs in Scala 3
Open
Nobody has claimed this yet.
- Dominant language
- Scala
- Stars
- 1.3k
- Forks
- 77
- Avg merge
- 9m
- Merged PRs (30d)
- 4
Description
The following code produces a different outcome when using Scala 3:
import com.softwaremill.macwire.wire
case class Berry(var name: String)
case class Basket(berry: Berry)
object Main extends App {
val blackberry: Berry = Berry("blackberry")
val basket: Basket = {
lazy val raspberry: Berry = Berry("raspberry")
wire[Basket]
}
println(basket.berry.name) // scala 2.13.30 raspberry, scala 3.0.2 blackberry
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Demo Repository and run the provided Main example under Scala 2.13.30 and Scala 3.0.2. Trace how wire[Basket] selects a Berry when blackberry and lazy raspberry are in scope. Done means the Scala 3 result is made consistent with the intended behavior, with a regression test covering this example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100