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

Occassionally, Link causes a .NET error when changing a function or an operator #643

Closed aplteam closed 3 months ago

aplteam commented 6 months ago

This is the error that pops up in the status window:

Void .ctor(Int64)
Void .ctor(Int64, System.DateTimeKind)
Void .ctor(Int32, Int32, Int32)
Void .ctor(Int32, Int32, Int32, System.Globalization.Calendar)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, System.DateTimeKind)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, System.Globalization.Calendar)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.DateTimeKind)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.Globalization.Calendar)
Void .ctor(Int32, Int32, Int32, Int32, Int32, Int32, Int32, System.Globalization.Calendar, System.DateTimeKind)

This is because of this line ([163] for me) in Link.Fix:

src(nsref U.Into)name nsref.{3 4∊⍨⎕NC ⍺:⍵(2⊃⎕AT ⍺) ⋄ ⍵}file

Because of the 2⊃ this relies on ⎕IO←1 in the namespace nsref is pointing to; if that's not the case, then a 0 is returned, which is an invalid argument for ⎕NEW DateTime, causing the error.

That means this can be fixed with

src(nsref U.Into)name nsref.{⎕IO←1 ⋄ 3 4∊⍨⎕NC ⍺:⍵(2⊃⎕AT ⍺) ⋄ ⍵}file

I am on 4.0.17