You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{code}
scala> class Foo(val a: Int) extends AnyVal { def foo = { {case x => x}: PartialFunction[Int, Int]; () }}
:7: error: implementation restriction: nested class is not allowed in value class
This restriction is planned to be removed in subsequent releases.
class Foo(val a: Int) extends AnyVal { def foo = { {case x => x}: PartialFunction[Int, Int]; () }}{code}
The text was updated successfully, but these errors were encountered:
@paulp said:
It's "spurious" in the sense that you shouldn't have to know that partial functions are implemented with anonymous objects; but it's genuine in the sense that partial functions are implemented with anonymous objects.
@retronym said:
I'm trying to remember exactly why the restriction exists (5d9cde105e); I suspect it is because we can't define an $outer pointer. But I don't think that is relevant for this case.
classFooextendsAnyVal {
deffoo= () =>0// okaydefbar= {case x => x} :PartialFunction[Int, Int] // should also be okay IMO
}
{code}
scala> class Foo(val a: Int) extends AnyVal { def foo = { {case x => x}: PartialFunction[Int, Int]; () }}
:7: error: implementation restriction: nested class is not allowed in value class
This restriction is planned to be removed in subsequent releases.
class Foo(val a: Int) extends AnyVal { def foo = { {case x => x}: PartialFunction[Int, Int]; () }}{code}
The text was updated successfully, but these errors were encountered: