[enh] fix issue 6549 - Implement contracts without implementation

This is a rebase of https://github.com/D-Programming-Language/dmd/pull/2281