[pureconfig] Refined cannot be read inside a Collection inside a Case Class inside a Collection
- Dominant language
- Scala
- Stars
- 1.7k
- Forks
- 152
- Avg merge
- 1h 20m
- Merged PRs (30d)
- 6
Description
Sorry about the long title, but this is a weird one and I wasn't sure how to name that.
I had the problem in my configuration, here's a simplified version:
```scala
object Test {
import pureconfig.generic.auto._
import eu.timepit.refined.pureconfig._
// I tried removing the refined import and explicitly declaring the implicit, but it didn't change anything
/* implicit val evidence: ConfigConvert[NonEmptyString] = new ConfigConvert[NonEmptyString] {
override def to(a: NonEmptyString): ConfigValue = ???
override def from(cur: ConfigCursor): Result[NonEmptyString] = ???
} */
implicit val evidenceMg: ConfigConvert[McGuffin] = new ConfigConvert[McGuffin] {
override def to(a: McGuffin): ConfigValue = ???
override def from(cur: ConfigCursor): Result[McGuffin] = ???
}
case class TestedNes(a: Set[NonEmptyString])
case class TestedNesList(a: List[NonEmptyString])
case class TestedPi(a: Set[PosInt])
case class TestedMg(a: Set[McGuffin])
class McGuffin
def successWithList = loadConfig[List[TestedNes]]
def successWithListInside = loadConfig[Set[TestedNesList]]
def successWithoutCollection = loadConfig[TestedNes]
def successWithoutCaseClass = loadConfig[Set[Set[NonEmptyString]]]
def successWithoutRefined = loadConfig[Set[TestedMg]]
def failureWithNonEmptyString = loadConfig[Set[TestedNes]]
def failureWithPosInt = loadConfig[Set[TestedPi]]
}
```
The definitions of failureWithPosInt and failureWithNonEmptyString do not compile.The same problem exists with Seq instead of Set, but it goes away with List either on the inner or the outer collection (so there's a workaround, but I'd rather have Sets as that's what makes sense in my model). It is linked to Refined somehow, as using a random class instead didn't fail (whether I'm using Set or Seq), but I just can't see how.
I'm using version 0.9.8 with refined-scalaz, refined-pureconfig and refined-scopt.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.