-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
scala/scala
#8716Description
This is a following bug to #11397
Indeed that bug was fixed, but as it turns out the general problem was not fixed. Here is a minimized code that throws an exception when the problem exists.
trait MyAny {
type TSomething
type This <: MyAny
}
class MyBool extends MyAny {
type TSomething = DummyImplicit
type This = MyBool
}
object Test extends App {
val i = new MyBool
var call = 0
var callList : List[Int] = List()
final class MyMatch[MV <: MyAny](val matchVal : MV) {
def myCase[MC](pattern : Boolean)(block : => Unit)(
implicit patternBld : matchVal.TSomething
) : MyMatch[MV] = {
call -= 1
block
this
}
}
def myMatch[MV <: MyAny](matchValue : MV) : MyMatch[matchValue.This] = {
callList = callList :+ call
call += 1
new MyMatch[matchValue.This](matchValue.asInstanceOf[matchValue.This])
}
myMatch(i)
.myCase(true) {
myMatch(i)
.myCase(true) {
}
}
.myCase(true) {
myMatch(i)
.myCase(true) {
}
}
assert(callList == List(0, 0, -1))
}Reactions are currently unavailable