Skip to content

Abstract properties are allowing additional generic arguments #12198

@MichalStrehovsky

Description

@MichalStrehovsky

We're seeing F# compiler emitting generic properties (which are invalid in the .NET assembly file format).

Repro steps

From Don in dotnet/linker#2281 (comment)

For example this: should be invalid but isn't being ruled out by the F# compiler:

type Thing =
    abstract Foo : 'Out with get, set

F# Interactive reports an error for this:

> type Thing =
-     abstract Foo : 'Out with get, set
- ;;


error FS0192: internal error: want tyvar #0, but only had 0 tyvars

Expected behavior

The code fails to compile.

Actual behavior

The code compiles and produces a property that doesn't work at runtime (CLR will throw BadImageFormatException when trying to use a PropertyInfo for it).

Known workarounds

Don't write such code.

Metadata

Metadata

Assignees

Labels

Area-Compiler-CheckingType checking, attributes and all aspects of logic checkingBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions