Skip to content

Add shorthand for generic type restrictions by non-generic interfaces #14477

@Lanayx

Description

@Lanayx

Is your feature request related to a problem? Please describe.

Since the F# 7 release there is a discrepancy between generic and non-generic restrictions, ie

allowed: env: 'T when ILogger<'T>
not allowed env: 'T when ILogger

Describe the solution you'd like

I propose to add support for non-generic case as well.

Describe alternatives you've considered

We can live with the old syntax env: 'T when 'T:> ILogger
Another possible syntax (covering multiple cases) could be env: #ILogger1 and #ILogger2

Additional context

This will allow to be more concise when dealing with a long list of restrictions, for example when implementing dependency injection based on the article https://bartoszsypytkowski.com/dealing-with-complex-dependency-injection-in-f/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions