At the moment refactor-check-compiles invokes swift-refactor twice, once to generate the output for -dump-text and once to generate the output for -dump-rewritten. This is duplicated effort. We should instead add an option to swift-refactor that outputs -dump-text to stdout and the contents of -dump-rewritten to a file. That way we could be generating both representations at the same time.
If anyone wants to tackle this as a starter bug:
- You would need to add a new flag like -rewritten-output-file in swift-refactor.cpp that dumps the rewritten text to the specified output file, just like the DumpType::REWRITTEN case does today here
- Afterwards, you’d need to update refactory-check-compiles.py to use that new argument to swift-refactor to retrieve the rewritten code together with the invocation that has -dump-rewritten, getting rid of the path that calls -dump-text and writes its stdout to the temp file.