@mmfl / @Fryie Right, I think we should file a bug here, would any of you mind filing one?
Here some stats: These are the number of files per module in the
$ cd Sources && for f in *; do find "$f" -name '*.swift' | wc -l | tr -d '\n' && echo " $f"; done | sort -n
So the largest module has 277 files. The total amount of files the Swift compiler as a whole seems to produce for this module is
$ find .build/x86_64-apple-macosx/debug/AccountTransactionApiV3p1p2Types.build/ -type f | wc -l
which means it seems to produce roughly 5 output files per input file. So if it wants to open the input file as well as all the output files all in one go, it will need more than 1024 files... I would argue that is a bit excessive and we should look into options to reduce this, if the compiler team determine that this is impossible or too much work, then the compiler should still output at least an actionable error message telling you to raise
ulimit -n to something high, it might even be able to give you an estimate given the number of source files.