Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler hangs on method taking a type with unit of measure derived from another unit of measure #2313

Closed
theprash opened this issue Dec 13, 2020 · 3 comments

Comments

@theprash
Copy link

theprash commented Dec 13, 2020

Description

Writing a method that takes a type with a unit of measure causes the compiler to hang forever with no error, but only if the measure is derived from another measure.

Repro code

[<Measure>] type Measure1
[<Measure>] type Measure2 = Measure1

type Class() =
    member _.Method(x: float<Measure2>) = x

The bug is also present for static methods.

Related information

Fable version: 3.0.1 on https://fable.io/repl/#

@inosik
Copy link
Contributor

inosik commented Dec 14, 2020

This rings a bell: #1975

@theprash Would you try to use metre instead of m, please? It's in the Microsoft.FSharp.Data.UnitSystems.SI.UnitNames namespace.

@theprash
Copy link
Author

@inosik Yes, this only happens when the unit of measure is derived from another one. I'll update the title and the repro code.

@theprash theprash changed the title Compiler hangs on any method taking a type with unit of measure Compiler hangs on method taking a type with unit of measure derived from another unit of measure Dec 14, 2020
@alfonsogarciacaro
Copy link
Member

Thanks a lot for reporting @theprash and for the pointer @inosik! There was a version of nonAbbreviatedType in OverloadSuffix that still could fall in the infinite loop. It only affects class members so we didn't see it before. I should put the helper in a common module somewhere to avoid these issues, but for now I just copied the code. It will be fixed in the next release 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants