Can't derive Diff for a case class with all default arguments
See original GitHub issueExample:
import com.softwaremill.diffx.Diff
// both args have defaults:
case class Buh(
a: String = "",
b: Int = 1
)
// fails
Diff[Buh]
Here is a runnable snippet: https://scastie.scala-lang.org/kKEQ1SZzTmudSGJGvO5BGg
This broke with the Magnolia version upgrade: https://github.com/softwaremill/diffx/pull/93
I tried overriding Magnolia version to the latest, but it didn’t help. Using latest Diffx with overriden Magnolia 0.12.8 does work.
So I know it’s a problem with Magnolia, but I thought it’s worth reporting here first. Let me know if I should report it there instead.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Add a parameter to a case class with a default - Stack Overflow
In all existing use cases, the parameter c would be true, hence it has that default value. Yet in some new use cases,...
Read more >Difference Between Class and Case Class in Scala - Baeldung
By default, all constructor parameters are public and immutable. ... with case classes: a case class can't inherit from another case class.
Read more >Support for default parameter values in generic #65 - GitHub
case class Foo(s: String, i: Int = 10) val json = """{"s": "Hello"}""" ... that a derived decoder will use default constructor values...
Read more >Case Classes | Tour of Scala
Case classes are like regular classes with a few key differences which we will go over. Case classes are good for modeling immutable...
Read more >Methods - C# Guide | Microsoft Learn
Arguments to the method can appear in any order, as long as all required arguments are present. The following example uses named arguments...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@laughedelic Lol,I didn’t expect that 😃 Sure, new release is rolling…
Hi,
Thanks for reporting. I’ve just released new version 0.3.26 with updated magnolia, so it should be available in maven central within a couple of hours.