Skip to content

Used variable for instantiation differs in Scala 3 #278

@phkorn

Description

@phkorn

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions