Updating references when renaming units within a namespace breaks references
- Lazarus/FPC Version: 2.2.7/3.2.3 (both latest from the fixes branch)
- Operating System: Windows 10 22H2
- CPU / Bitness: 64
What happens
Having two units named MyNamespace and MyNamespace.unit1, when renaming the namespace part of MyNamespace.unit1 to OtherThing.unit1 and updating project references, the updated references get corrupted.
This also happens with nested namespaces when a higher level namespace exist: A.B.unit1, A.B.C.unit1...
What did you expect
The renamed file being properly refactored.
Steps to reproduce
Attached is a sample project. Open it, then open the file namespace1.unit1, click on File>Save as... and change the namespace part of the unit (namespace1) to any valid identifier. The IDE will prompt to update references, click Yes or Yes to all. Now open the project file and see the uses section. Both MyNamespace and MyNamespace.unit1 get updated resulting in invalid syntax.
This problem exist at least since previous Lazarus release and also seems to exist in 3.0.RC1