Skip to content

Recursive use of inline member should produce better diagnostic #17991

@vzarytovskii

Description

@vzarytovskii

The following code

type ID3(vl: _) =
    member _.Value = vl

    member inline this.FastEquals(other: ID3) =
        this.FastEquals(other)

Is currently producing the following diagnostics:

    error FS1114: The value '_.ID3.FastEquals' was marked inline but was not bound in the optimization environment
    error FS1113: The value 'FastEquals' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible
    error FS1114: The value '_.ID3.FastEquals' was marked inline but was not bound in the optimization environment
    error FS1113: The value 'FastEquals' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible
    error FS1114: The value '_.ID3.FastEquals' was marked inline but was not bound in the optimization environment
    error FS1113: The value 'FastEquals' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible
    error FS1114: The value '_.ID3.FastEquals' was marked inline but was not bound in the optimization environment
    error FS1113: The value 'FastEquals' was marked inline but its implementation makes use of an internal or private function which is not sufficiently accessible

which are quite misleading.

I propose we improve diagnostic with something like "Functions and members cannot be both inline and recursive".

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-Diagnosticsmistakes and possible improvements to diagnosticsBugFeature RequestImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.

    Type

    No fields configured for Bug.

    Projects

    Status

    New

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions