This is a continuation of D72756. It uses one of test cases made by Peter Smith which was
not included to the final version of the patch (we've agreed to place a FIXME that time).
This patch suggests a change to support this missing part.
(I am not sure how much it is useful feature, but I think we do not want to have this FIXME
and IMO this change makes the code a bit cleaner).