Skip to content

Compiler type inference regression #2730

@saul

Description

@saul
type 'a Doge () = class end
with
    static member (|~>) (_ : 'b Doge, _ : 'b -> 'c) : 'c Doge = Doge ()

let x : System.DateTime Doge = Doge ()

let y = x |~> (fun dt -> dt.Year) // error on this line around 'dt.Year'

In F# 4.0 (and prior), the above code worked fine. However in F# 4.1 there seems to have been some kind of regression:

regress.fsx(7,26): error FS0072: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to c
onstrain the type of the object. This may allow the lookup to be resolved.

This regression means we cannot use F# 4.1 (or VS 2017 due to IntelliSense errors) at work due to this regression in type inference that the code heavily depends upon.

/cc @dsyme

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions