Skip to content

Internal error FS0073: Undefined or unsolved type variable: 'TRange when compile in Release mode #31

@KevinRansom

Description

@KevinRansom

[From fsbugs]

When compiling below code with --optimize+, get internal error:
Program.fs(27,9): error FS0073: internal error: Undefined or unsolved type variable: 'TRange

namespace QuotationsProblem

open Microsoft.FSharp.Quotations

type Class1() =

    member private this.CompileQuery<'T>() =
        let kernel = System.Activator.CreateInstance<'T>()
        kernel

    member this.X (query: Expr<'TRange ->'a>) =
        let rng = ref Unchecked.defaultof<'TRange>
        let getStarterFuncton qExpr =
            let rec go expr vars =
                match expr with
                | Patterns.Lambda (v, body) -> Expr.Lambda(v, go body (v::vars))
                | e ->
                    let arr =
                        let c = Expr.NewArray(typeof<obj>,vars |> List.rev
                            |> List.map (fun v -> Expr.Coerce (Expr.Var(v), typeof<obj>)))
                        <@@
                            let x = %%c |> List.ofArray
                            rng := (box x.Head) :?> 'TRange
                        @@>
                    arr
            1
        getStarterFuncton query

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions