Dyalog / link

Source code for Link – the built-in component that enables the use of text files as the primary storage mechanism for APL source code
https://dyalog.github.io/link
MIT License
19 stars 12 forks source link

Link protests overwriting an existing item if the (sub-)nameclass is changed #642

Open abrudz opened 6 months ago

abrudz commented 6 months ago

Describe the bug Link protests overwriting an existing item if the (sub-)nameclass is changed compared to the existing value. This can e.g. happen if editing dfn, giving it the same name as an existing tradfn (i.e. this has nothing to do with the specific use of add in the repro below). Link ends up with an orphaned file.

To Reproduce

      ]create # C:\tmp\issue
Linked: # ←→ C:\tmp\issue
      ⎕FX'baz' 'baz'
      ]add baz
Added: #.baz
      baz←{baz}
      ]add baz
Link Warning: Cannot write baz to "C:/tmp/issue/baz.aplf" - that file defines baz
Link Warning: Writing baz to file "C:/tmp/issue/baz~2.aplf"
Added: #.baz

Expected behaviour Silently overwrite the existing item (at least if compatible, i.e. 3/4 and 2/9).

Desktop (please complete the following information):