Skip to content

The result of a method, taking an object of some case class, can not be assigned to a variable with the name as the name of any field of that class #5044

Closed
@scabug

Description

@scabug
case class A(
  id: Int = 0,
  name: String = "",
  age: Int = 20
)

object Tmp {

  def m(a: A) = ""
  
  def main(args: Array[String]) {
    val a = A(name = "")
    val name = Tmp.m(a) // compiler error: recursive value a needs type
    println(">")
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions