Skip to content

Regression: inline data for method (related to witness passing PR) #9449

@dsyme

Description

@dsyme

I think the changes for #6345 have caused a regression where inlining data is no longer being stored for some kind of code involving SRTP calls. I can't yet determine the exact issue but here is a repro, it is related to the failures in #6811 since integrating with master

lib.fs:

module T 

let inline RequireM< ^Witnesses, ^T when (^Witnesses or ^T): (static member M : ^TaskLike -> string) > () : string = 
    ((^Witnesses or ^T): (static member M : ^T-> string) (Unchecked.defaultof<_>))

type C() = class end

[<Sealed>] 
type Witnesses() =

    static member M (x: C) : string = failwith ""

    static member M (x: int64) : string = failwith ""


type StaticMethods() = 

    static member inline M< ^T when (Witnesses or  ^T): (static member M: ^T-> string)>  (task: ^T) : string =

        RequireM< Witnesses, ^T> ()

app.fs:

open T
let tbind(t:C) =
        T.StaticMethods.M(t)

Run

artifacts\bin\fsc\Debug\net472\fsc --optimize- -a --langversion:preview lib.fs
artifacts\bin\fsc\Debug\net472\fsc.exe -r:lib.dll --optimize- --langversion:preview app.fs

Expected: compilation succeeds

Actual: compilation fails:

t.fs(20,26): error FS1113: The value 'M' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible

a.fs(3,9): warning FS1116: A value marked as 'inline' has an unexpected value

a.fs(3,9): error FS1118: Failed to inline the value 'M' marked 'inline', perhaps because a recursive value was marked 'inline'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions