MoiraeSoftware / myriad

Myriad is a code generator for F#
https://moiraesoftware.github.io/myriad/
Apache License 2.0
344 stars 43 forks source link

error when using SynType.CreateApp #179

Open joprice opened 3 weeks ago

joprice commented 3 weeks ago

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

7sharp9 commented 3 weeks ago

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

joprice commented 6 days ago

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.

7sharp9 commented 5 days ago

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.