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
caseclassFoo(price: Int)
caseclassBar(cost: Int)
defmoo(in: AnyRef):String= in match {
casep: {defprice:Int} =>"price "+p.price
casec: {defcost:Int} =>"cost "+c.cost
case _ =>"Unknown"
}
println(moo(Bar(33)))
results in the following compilation warnings:
pony:~/tmp dpp$$ scala -unchecked some3.scala
(fragment of some3.scala):5:warning: refinement AnyRef{defprice:Int} in typepattern is unchecked since it is eliminated by erasure
casep: {defprice:Int} =>"price "+p.price
^
(fragment of some3.scala):6:warning: refinement AnyRef{defcost:Int} in typepattern is unchecked since it is eliminated by erasure
casec: {defcost:Int} =>"cost "+c.cost
^
two warnings found
However, the types can be discovered at runtime and should not be eliminated by erasure.
And yes, this could be considered an enhancement :-)
The text was updated successfully, but these errors were encountered:
The following code:
results in the following compilation warnings:
However, the types can be discovered at runtime and should not be eliminated by erasure.
And yes, this could be considered an enhancement :-)
The text was updated successfully, but these errors were encountered: