Fix, expand and tweak tests.
Start porting aliasing+annotations support implementation from original patch.