> inheritance as a means to share code is bad,
Not necessarily; if they are strongly coupled related concepts within the same module then it is perfectly fine (eg. private inheritance in C++). Here you are basically structuring for code reuse and not is-a relationship.
>inheritance as a means to leverage polymorphism is good.
This is the "standard" idea of inheritance i.e. sub-typing using Liskov Substitution Principle.
> Polymorphic classes can still share code, but this should be done using composition.
Not necessarily as a combination of the above two should make clear.