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
@retronym said:
Changing Number to a non-case class works:
objectTestextendsApp {
classNumber(i: Int)
objectUnliftNumber {
defunapply(t: Any):Option[Number] = t match {
casei: Int=>Some(newNumber(i))
case _ =>None
}
}
defeval(expr: Any):Option[Number] = expr match {
caseUnliftNumber(n) =>Some(n)
case _ =>None
}
println(eval(1))
}
This code seems culpable:
/** If this is a case class, the case field accessors (which may be an empty list.) * Otherwise, if there are any product selectors, that list. * Otherwise, a list containing only the type itself.*/deftypesOfSelectorsOrSelf(tp: Type):List[Type] = (
if (tp.typeSymbol.isCase)
typesOfCaseAccessors(tp)
else typesOfSelectors(tp) match {
caseNil=> tp ::Nilcase tps => tps
}
)
If we the return type of eval is ommited the code compiles and runs just fine:
The text was updated successfully, but these errors were encountered: