paulbutcher / ScalaMock

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

Scala 3 PathDependent Mock issue #502

Closed 0lejk4 closed 7 months ago

0lejk4 commented 9 months ago

ScalaMock Version (e.g. 3.5.0)

6.0.0-M1

Scala Version (e.g. 2.12)

3.3.1

Runtime (JVM or JS)

JVM

Please describe the expected behavior of the issue

Successfully created mock instance for path-dependent method

Please provide a description of what actually happens

[error] | val pathDependent = stub[PathDependent] [error] | ^^^^^^^^^^^^^^^^^^^ [error] | Found: cmd.Answer [error] | Required: cmd.Answer [error] |--------------------------------------------------------------------------- [error] | Explanation (enabled by -explain) [error] |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [error] | [error] | Tree: this.mock$call$0.apply(cmd).asInstanceOf[cmd.Answer] [error] | I tried to show that [error] | cmd.Answer [error] | conforms to [error] | cmd.Answer [error] | but the comparison trace ended with false: [error] | [error] | ==> cmd.Answer <: cmd.Answer [error] | ==> cmd.type <: (cmd : T) [error] | ==> T <: (cmd : T) (left is approximated) [error] | ==> Command <: (cmd : T) in frozen constraint [error] | <== Command <: (cmd : T) in frozen constraint = false [error] | <== T <: (cmd : T) (left is approximated) = false [error] | <== cmd.type <: (cmd : T) = false [error] | ==> Any <: cmd.Answer (left is approximated) [error] | <== Any <: cmd.Answer (left is approximated) = false [error] | <== cmd.Answer <: cmd.Answer = false [error] | [error] | The tests were made under the empty constraint [error] ---------------------------------------------------------------------------

Reproducible Test Case

  trait Command {
    type Answer
  }
  trait PathDependent {
    def call[T <: Command](cmd: T): cmd.Answer
  }

  val pathDependent = mock[PathDependent]
goshacodes commented 9 months ago

On it

goshacodes commented 8 months ago

Implemented in 6.0.0-M2