Skip to content

case class misbehaves with only implicit parameter list #10097

Closed
@scabug

Description

@scabug

Comment stolen from paulp’s explanation:

It should fail the compile with error: case classes without a parameter list are not allowed but the implicit parameter list fools it. Then it proceeds to act in a very confused manner, for instance turning all the explicitly written implicit parameters into case accessors.

scala> case class Bip(implicit x: Int, y: Int)
defined class Bip

scala> Bip()(1, 2).productArity
res4: Int = 2

But naturally it eventually inserts the empty parameter list, as seen above. Whereas:

scala> case class Bip2()(implicit x: Int, y: Int)
defined class Bip2

scala> Bip2()(1, 2).productArity
res5: Int = 0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions