This can work awesome for small programs and clear algorithms, but as is hinted in the article, one has to first create a correct specification.
I gave an example in another post, here's another: unforeseen interactions between two components built to spec.
A sufficiently powerful type system can compute any partial recursive function at type check time. That's pretty much the upper bound.
At what cost?
I'd estimate it to be at least 10x development cost.
But they won't prevent a programmer from using MD5 for RSA signature verification.
Also, C++ static types are rather weak. Its optional types are useful, but its not like in SML where the compiler ensures that you handled all possible cases.
A good type system can't catch all kinds of errors though.
You're thinking at code level, people like Leveson, Knight and others are thinking at system level. The end goal is to have a safe system, not e.g avoid null pointer exceptions through optional types.