I see many solution here that do not require any language change.
To start, have a linter yell at the programmer when (s)he submit
a diff. Dev commit directly ? What the fuck are you doing ? Do
code review and get a linter.
Alternatively, generate a di file and hash it. You can have a bot
do it and commit with a commit hook.
DMD can dump infos about the program in json format. hash this
and run with it.
You may also change your strategy in term of source control:
https://www.youtube.com/watch?v=W71BTkUbdqE . Unified source code
aleviate completely these kind of issues to boot.