weaver-test icon indicating copy to clipboard operation
weaver-test copied to clipboard

`expect` broken with `inline def` and `opaque type`

Open armanbilge opened this issue 3 years ago • 1 comments

//> using lib "com.disneystreaming::weaver-cats:0.8.0"
//> using testFramework "weaver.framework.CatsEffect"

import weaver.*

opaque type Foo = Int
object Foo:
  inline def fromInt(x: Int): Foo = x
  inline def plus(x: Foo, y: Foo): Foo = x + y

object OpaqueSuite extends FunSuite:
  test("asserts") {
    val two: Foo = Foo.fromInt(2)
    val three: Foo = Foo.fromInt(3)
    val five: Foo = Foo.fromInt(5)
    expect(Foo.plus(two, three) == five)
  }
$ scala-cli test bug.scala 
Compiling project (Scala 3.2.0, JVM)
[error] ./bug.scala:16:26: Found:    (three : Foo)
[error] Required: Int
[error]     expect(Foo.plus(two, three) == five)
[error]                          ^^^^^
Error compiling project (Scala 3.2.0, JVM)

armanbilge avatar Oct 02 '22 00:10 armanbilge

Reproducible with vanilla Expecty ~~so I'm gonna transfer the issue there~~ lol, can't do that in a different org.

Anyways, it's a bug on Expecty, I'll take a look. I expect there to be a lot of these - we barely test new scala 3 features at all.

keynmol avatar Oct 02 '22 09:10 keynmol

We can close this since it's not a bug here.

armanbilge avatar Aug 21 '23 21:08 armanbilge