dotnet / dotnet/fsharp

[<CompiledName>] ignored on extension properties

Open
#9,405 2 comments 0 reactions 0 assignees View on GitHub
Area-Compiler-Checking Area-Compiler-Checking-Attributes Bug Impact-Low
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Applying `[]` to make the public interface of an assembly look more C#-friendly, I noticed a few places where it didn't take.

**Repro steps**

Provide the steps required to reproduce the problem:

Create new library project, and use this source
```
namespace Example
module Extension =
type System.Int32 with
[]
member self.Increment (b : bool) =
self + if b then 1 else 0
member self.IsPositive
with [] get() =
self > 0
[]
member self.IsNegative
with get() =
self < 0

type File =
| Raw of System.String
| Info of System.IO.FileInfo
with member self.FileName
with [] get() =
match self with
| Raw s -> s |> System.IO.Path.GetFileName
| Info i -> i.Name
[]
member self.DirectoryName
with get() =
match self with
| Raw s -> s |> System.IO.Path.GetDirectoryName
| Info i -> i.DirectoryName
```
2. Build and examine the resulting assembly

**Expected behavior**

All `[]` values applied

**Actual behavior**

Class `File` has properties `ItemName` and`PropDirectory` --properties renamed OK
Class `Extension` has members `MaybeIncrement`, `Int32.get_IsNegative` and `Int32.get_IsPositive` -- only the non-property extension renamed

**Known workarounds**

None so far

**Related information**

Windows 10 home 1909
Reproduces with both .NET SDK 3.1.300 and 5.0.100-preview.4.20258.7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.