paulbutcher / ScalaMock

Native Scala mocking framework
http://scalamock.org/
MIT License
503 stars 98 forks source link

Scala3 Intersection Type Issue #514

Closed migiside closed 6 months ago

migiside commented 6 months ago

Thank you for your work to support scala3!

ScalaMock Version (e.g. 3.5.0)

6.0.0-M2

Scala Version (e.g. 2.12)

3.3.3

Runtime (JVM or JS)

Eclipse Adoptium Java 21.0.2

Please describe the expected behavior of the issue

It should compile.

Please provide a description of what actually happens

compile error

[error] 25 |    val m = mock[Sample]
[error]    |                        ^
[error]    |                        Found:    (v : T & Base)
[error]    |                        Required: T² & Base
[error]    |
[error]    |                        where:    T  is a type in method f
[error]    |                                  T² is a type variable
[error]    |

Reproducible Test Case


trait Base

trait Sample {
  def f[T](v: T & Base): Unit
}

object Test extends AsyncFunSuite with AsyncMockFactory {

  test("intersection type") {

    val m = mock[Sample]

    succeed
  }
}
goshacodes commented 6 months ago

Hi, thank you, fix is ready. We will publish it soon

migiside commented 6 months ago

Thanks for the quick fix!