Committing standard compare/to_str/clone features, but no tests yet.

Wrote some tests for the compare/clone/to_str methods.

Took out doc comments around tests.

Don't allow impls to force public types

This code in resolve accidentally forced all types with an impl to become
public. This fixes it by default inheriting the privacy of what was previously
there and then becoming `true` if nothing else exits.

Closes #10545

Committing to show work in progress.  Everything is still messy,
but I want to take this opportunity to get feedback from relevant
parties if I can.

Recommitting after a bad commit that unnecessarily changed files.
Added more robust compare and equals for Branch and Leaf, as well
as some style changes.