Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Scala compiler error with "Synthetic tree contains nonsynthetic tree"?

I have a following test

test("should create cached thread pool") {
    val globalContextMock: LogContextPropagatingEC = mock[LogContextPropagatingEC]
    val util = new PaymentExecutionContextImpl with ApplicationConfigTest2 {
        override protected lazy val globalExecutionContext = globalContextMock
    }
    val systemContext = util.systemExecutionContext
    assert(!systemContext.eq(globalContextMock), "system execution context should be a new instance, different form global mock")
}

which causes Scala compile the following error:

RangePositions$ValidateException: Synthetic tree [1889] contains nonsynthetic tree [1874]

Anyone knows what causes the issue?

like image 881
Yuri Avatar asked Dec 07 '25 23:12

Yuri


1 Answers

You're compiling with -Yrangepos? If so, and you're using 2.10, it's a bug/issue with the compiler verifying trees that were (probably) modified by macros.

like image 142
sksamuel Avatar answered Dec 09 '25 19:12

sksamuel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!