Open steinybot opened 3 years ago
Removing the name
field from Bar
causes the problem to go away.
Sometimes this can be worked around by putting the body inside another method. Such as:
Rx(x)
def x: Bar = {
val bar: Bar = ???
val foo: Foo[_] = ???
bar.copy(foo = foo)
}
There are times where this doesn't work, such as when the existential type is coming from outside as in:
val y: Rx[Foo[_]] = Rx(x)
def x: Foo[_] = {
???
}
In this case you have to use Rx.build
:
val y: Rx[Foo[_]] = Rx.build(x)
def x(owner: Owner, data: Data): Foo[_] = {
???
}
There is a weird problem where using an existential type with an
Rx
causes the compiler to get confused.I have minimal reproduction here: https://github.com/steinybot/bug-reports/tree/scalarx/existentials
Output: