Scala infers and synthesizes quite a lot of cruft.
It could synthesize the required HasExpirationDate trait for CreditCard and Account, assuming everything compiled together.
A contract is an agreement between two parties. What is called a contract in API design is merely fiat, an offer you can’t refuse.
This one-sided state of affairs is normalized by programmers who are accustomed to top-down decision making.
Currently, the only tool wielded by the consumers is to organize a strike or, in another metaphor, a boycott.
The other metaphor sanctioned by computing culture is opting into cookies. “If you don’t like our offering, you can refuse and everything will break.” That is also not a contract.