ScalaMock icon indicating copy to clipboard operation
ScalaMock copied to clipboard

Option of nested trait causes "method has incompatible type" error

Open DGolubets opened this issue 10 years ago • 2 comments

Here is the type I want to macro mock:

trait SimpleService {
  trait SomeTypeLike {
    val text: String
  }

  def getSomething: Option[SomeTypeLike]
}

But I get compile error:

method getSomething has incompatible type

However, if I change the return type from Option[SomeTypeLike] to SomeTypeLike it compiles. If I move SomeTypeLike out of SimpleService - compiles too.

Complete sample: https://drive.google.com/file/d/0B54NYsj9RHeaanRsNDVUQjgwMzA/edit?usp=sharing

DGolubets avatar May 02 '14 18:05 DGolubets

Thanks. But I'm afraid that this is definitely one of those examples that will have to wait for Palladium

paulbutcher avatar May 02 '14 20:05 paulbutcher

Complied with Scala 3. This can be closed

goshacodes avatar Feb 25 '24 10:02 goshacodes