Minimize number of tool execution runs (#1898)

* canonicalFor must be declared literally in the library

* Add tests for minimizing tool execution

* dartfmt

* Workaround problem with mixins on 2.1.0 stable

* Review comments