-
Notifications
You must be signed in to change notification settings - Fork 843
Closed
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone
Description
There is no compile-time error if a type only partially implements an interface with static abstract members (IWSAM). If you try to use the partial implementation, a System.TypeLoadException is raised at runtime.
Repro steps
#nowarn "3535"
type IFace =
static abstract P1 : int
static abstract P2 : int
type T =
interface IFace with
static member P1 = 1
let inline p1<'T & #IFace> = 'T.P1
p1<T>Runtime error:
Unhandled exception. System.TypeLoadException: Virtual static method 'get_P2' is not implemented on type 'T' from assembly 'ConsoleApp1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
at <StartupCode$ConsoleApp1>.$Program.main@()
Expected behavior
There should be a compile-time error indicating that all abstract methods on the interface must be implemented.
Actual behavior
There is no compile-time error; there is an error at runtime instead.
Known workarounds
N/A
Related information
.NET 8/9 preview.
edgarfgp
Metadata
Metadata
Assignees
Labels
Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingType checking, attributes and all aspects of logic checkingBugImpact-Low(Internal MS Team use only) Describes an issue with limited impact on existing code.(Internal MS Team use only) Describes an issue with limited impact on existing code.
Type
Projects
Status
Done