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

Used variable for instantiation differs in Scala 3 #278

Open
phkorn opened this issue Feb 10, 2023 · 2 comments
Open

Used variable for instantiation differs in Scala 3 #278

phkorn opened this issue Feb 10, 2023 · 2 comments

Comments

@phkorn
Copy link

phkorn commented Feb 10, 2023

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
}
@adamw
Copy link
Member

adamw commented Feb 10, 2023

@mbore maybe you have an idea if this is possible to fix?

@djx314
Copy link

djx314 commented Feb 11, 2023

If understood macwire as scala implicit(get by Context in this position). It's better to throw a compile time Exception.

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

3 participants