question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't derive Diff for a case class with all default arguments

See original GitHub issue

Example:

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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
ghostbuster91commented, Apr 10, 2020

@laughedelic Lol,I didn’t expect that 😃 Sure, new release is rolling…

1reaction
ghostbuster91commented, Apr 10, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found