Skip to content

Recursive functions defined inside computation expressions fail after installing VS 15.5 preview 1 #3743

Closed

Description

@dhwed

After installing VS 15.5 preview 1, this fails:

[<EntryPoint>]
let main argv =
    let factorials =
        [ for x in 0..10 do
            let rec factorial x =
                match x with
                | 0 -> 1
                | x -> x * factorial(x - 1)
            yield factorial x
        ]

    for f in factorials do printf "%i" f
    
    0 // return an integer exit code

image

This happens even in VS 15.4 now.

Activity

  1. changed the title [-]Recursive functions defined inside list comprehensions fail after installing VS 15.5 preview 1[/-] [+]Recursive functions defined inside computation expressions fail after installing VS 15.5 preview 1[/+] on Oct 12, 2017
  2. dsyme commented on Oct 12, 2017

    @dsyme
    Contributor

    @dhwed Oh wow, that's a regression. The culprit will be #3536

  3. dsyme commented on Oct 12, 2017

    @dsyme
    Contributor

    @cartermp I'll start working on a fix for this regression tomorrow

  4. added
    Impact-High
    on Oct 12, 2017
  5. dsyme commented on Oct 12, 2017

    @dsyme
    Contributor

    Workaround 1 - in this case compiling in "Release" mode makes NRE go away

    Workaround 2 - lift the let rec out of the list/array/sequence expression, adding any captured variables as arguments

  6. dsyme commented on Oct 24, 2017

    @dsyme
    Contributor

    Fixed by undoing the fix, When we fix the fix it will all be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-HighRegression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions