OK. I have fixed the first problem where the sloc of the static on demand import is invalid. It is now correctly being calculated by the antlr parser.
The next problem is that we are not properly recording the imports in the ImportRewrite and so the object thinks that they should be deleted (since we haven't recorded them).
In the long term, we should properly walk the AST and look for references to the import (and remove if there really are no more references), but for now, we can just ignore them and always keep them around if they exist.