Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intrinsic extensions for static methods in interfaces fail to compile #15990

Closed
gusty opened this issue Sep 18, 2023 · 0 comments · Fixed by #16157
Closed

Intrinsic extensions for static methods in interfaces fail to compile #15990

gusty opened this issue Sep 18, 2023 · 0 comments · Fixed by #16157
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@gusty
Copy link
Contributor

gusty commented Sep 18, 2023

Intrinsic extensions for static methods in interfaces fail to compile

Repro steps

[<Interface>]
type MyInterface<'T> =
    interface end
type MyInterface with
    static member ByPass (x: MyInterface<'t>) = x

Expected behavior

Compile

Actual behavior

Error: stdin(6,6): error FS0956: Members that extend interface, delegate or enum types must be placed in a module separate to the definition of the type. This module must either have the AutoOpen attribute or be opened explicitly by client code to bring the extension members into scope.

Known workarounds

Removing lines 2 and 3, but obviously in real life code this means duplicating all the module let bindings code that might sit between those 2 lines and are needed to implement ByPass and other static members defined in the interface.

Related information

Provide any related information (optional):

Microsoft (R) F# Interactive version 12.8.0.0 for F# 8.0

@github-actions github-actions bot added this to the Backlog milestone Sep 18, 2023
@0101 0101 added Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. Area-Compiler-Checking Type checking, attributes and all aspects of logic checking and removed Needs-Triage labels Sep 25, 2023
@github-project-automation github-project-automation bot moved this from Future to Done in F# Compiler and Tooling Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compiler-Checking Type checking, attributes and all aspects of logic checking Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants