Closed jnicoulaud-ledger closed 8 months ago
Sometimes, name changes like this mess up with incremental compilation. Did you try to clean the compiler cache?
Yes, it was a clean build. Also tried removing wartremover, scalafix and upgrading to scala 3.3.1 with same result. I will try to reduce my project to the bare minimum...
It would also be useful to know where the compiler produces this error. Does it occur when compiling the file containing your new types or when compiling a file using them?
I created a minimal reproducing project here: https://github.com/jnicoulaud-ledger/iron-issue-190-reproducer You can see the compiler crash in the CI: https://github.com/jnicoulaud-ledger/iron-issue-190-reproducer/actions/runs/6754239254/job/18361529999#step:4:32 (gave you push access to this repo if you want to experiment)
edit: well basically, this compiles on iron 2.2.1:
import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.numeric.*
import sttp.tapir.Codec.PlainCodec
import sttp.tapir.codec.iron.TapirCodecIron
opaque type Version = Int :| GreaterEqual[0]
object Version extends RefinedTypeOpsImpl[Int, GreaterEqual[0], Version] with TapirCodecIron:
given PlainCodec[Version] = ironTypeCodec
this crashes on iron 2.3.0:
import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.numeric.*
import sttp.tapir.Codec.PlainCodec
import sttp.tapir.codec.iron.TapirCodecIron
opaque type Version = Int :| GreaterEqual[0]
object Version extends RefinedTypeOps[Int, GreaterEqual[0], Version] with TapirCodecIron:
given PlainCodec[Version] = ironTypeCodec
This compiles: https://github.com/jnicoulaud-ledger/iron-issue-190-reproducer/tree/fix/issue-190
The Tapir's Iron integration probably just needs to be updated.
This PR should solve this issue once merged: https://github.com/softwaremill/tapir/pull/3298
For the time being, you can use the code I pushed on https://github.com/jnicoulaud-ledger/iron-issue-190-reproducer/tree/fix/issue-190
I could have thought of that :facepalm: thank you :)
Describe the bug Scala environment: JVM Scala version: 3.3.0 Iron version: 2.3.0
Reproduction steps The steps to reproduce the described issue
RefinedTypeOpsImpl
toRefinedTypeOps
for opaque typesExpected behavior Compilation successful
Current behavior Compilation fails with error: