You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
@som-snytt said:
Inconsistent, yet it's almost a feature, except for pattern matching:
scala>caseclassC(implicitc: Int)
defined classC
scala>implicitvali:Int=42
i:Int=42
scala>C() match { case x @C() => x }
res0:C=C(42)
scala>C() match { case x @C(i) => i }
<console>:15:error: wrong number of arguments for pattern C()
C() match { case x @C(i) => i }
^
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.
But naturally it eventually inserts the empty parameter list, as seen above. Whereas:
The text was updated successfully, but these errors were encountered: