softwaremill / softwaremill/macwire

Used variable for instantiation differs in Scala 3

Open
#278 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.3k
Forks
77
Avg merge
9m
Merged PRs (30d)
4

Description

Demo Repository

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.