FSharp.TypeProviders.SDK icon indicating copy to clipboard operation
FSharp.TypeProviders.SDK copied to clipboard

Infinite loop when comparing a unit of measure abbreviation with another type

Open mlaily opened this issue 1 year ago • 1 comments

Description

While working on FSharp.Data, I noticed that comparing a UoM abbreviation type with a IJsonDocument type causes an infinite recursion/loop.

Repro steps

On FSharp.Data, I triggered this with the JsonProvider and an inline schema containing an abbreviated UoM:

type InlineSchemas = JsonProvider<""" {"a": "typeof<int<m>>"} """, InferenceMode=InferenceMode.ValuesAndInlineSchemasOverrides>

image

Note the lack of full syntactic colorization, since the IDE is caught in the loop.

Known workarounds

Replacing m with metre works: no infinite loop.

EDIT: ah it seems I was just lucky to pick one that was not in the list!
After completing the list in this PR https://github.com/fsprojects/FSharp.TypeProviders.SDK/pull/394, metre is now considered as a FSharpTypeAbbreviation, and the equality check loops the same way as with m! :/

Related information

I tried updating the github commit of the SDK referenced by FSharp.Data, but the problem still exists.

I'm not sure how to fix it, but in case it helps, here are a few screenshots of the looping methods:

image

image

image

And back to square one: image

mlaily avatar Mar 10 '23 21:03 mlaily

I'd appreciate any pointer about how to fix that :)

mlaily avatar Mar 11 '23 17:03 mlaily