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
// Fails to compile@typeclass traitF[A] { self =>typeB=Adeff(a: A):Option[B]
}
// Fails to compile@typeclass traitG[A] { self =>typeB=Adeff(a: A):Option[self.B]
}
// Compiles but doesn't generate an op for f@typeclass traitH[A] { self =>typeB=Adeff(b: B):Option[A]
}
The text was updated successfully, but these errors were encountered:
mpilquist
changed the title
Hygiene problems when extension methods refer to type members of type class
Hygiene problems when ops-eligible methods refer to type members of type class
Sep 8, 2015
I looked at this, and it's pretty well hopeless for the same reason as #55.
// Method should only be adapted if the first parameter in the first parameter list// matches `tparamName`valTargetTypeName= tparamName
It's not possible to generate correct code when correctness depends on knowing how names are bound but ad hoc string matching is being used to attempt to approximate that.
Your best bet is to severely restrict how people can write their type classes so the necessary information can be obtained before typechecking.
Some examples:
The text was updated successfully, but these errors were encountered: