myriad icon indicating copy to clipboard operation
myriad copied to clipboard

error when using SynType.CreateApp

Open joprice opened this issue 1 year ago • 3 comments

SynType.CreateApp throws the error System.Exception: unexpected type: App. This seems to be caused by missing lessRange and greaterRange arguments, which I assume are required when isPostfix is false.

https://github.com/MoiraeSoftware/myriad/blob/3c9818faabf9d508c10c28d5ecd26e66fafb48a1/src/Myriad.Core/AstExtensions.fs#L195-L196

joprice avatar Oct 11 '24 02:10 joprice

Im guessing its just a case of adding a few range0 where they are expected to be present.

7sharp9 avatar Oct 12 '24 09:10 7sharp9

Yea adding lessRange = Some range0 and greaterRange = Some range0 works for me. I can do a pr. I didn't at first since I'm relatively new to the lib and AST libs it uses, so I wasn't sure why I was hitting this and whether it would break other people to add them. I thought it might have something to do with shifting AST structures between versions or something along those lines.

joprice avatar Oct 29 '24 03:10 joprice

Yeah when the AST is updated there's typically something added in so it's just a matter of adding in fake locations for the code start/end elements.

7sharp9 avatar Oct 30 '24 00:10 7sharp9