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
traitTC[T]
objectTC {
defoptionTCForPart[T](implicittc: TC[ExtractPart[T]]):TC[Option[ExtractPart[T]]] =newTC[Option[ExtractPart[T]]] {}
}
typeExtractPart[T] =Tmatch {
casePartField[t] => t
}
typePartField[T] =Any { typePart=T }
classValuePartHolder {
typePart=Value
}
classValueobjectValue {
implicitvaltcValue:TC[Value] =new {}
}
@main defmain():Unit= {
// import Value.tcValue // explicit import works around the issue, but shouldn't be necessaryvaltc=TC.optionTCForPart[ValuePartHolder]
println(tc)
}
Output
valtc=TC.optionTCForPart[ValuePartHolder]
^Nogiveninstance of typeTC[ExtractPart[ValuePartHolder]]
was found for parameter tc of method optionTCForPart in objectTCThe following importmightfixtheproblem:importValue.tcValue
Expectation
Expected to work, since ExtractPart[ValuePartHolder]] evaluates to Value and Value companion object already contains the instance, making explicit import redundant.