dotnet / dotnet/fsharp

Compiler doesn't accept methods with overloaded nativeptr variants

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

Description

Please provide a succinct description of the issue.

The compiler thinks that the type `nativeptr` is equal to `nativeptr` for overloading members which is wrong.

**Repro steps**

Provide the steps required to reproduce the problem:

```fsharp
type IGL =
abstract member Color3 : nativeptr->unit
abstract member Color3 : nativeptr->unit
```

If possible attach a zip file with the repro case. This often makes it easier for others to reproduce.
The zip file should ideally represent the situation just before the call/step that is problematic.

**Expected behavior**

This compiles to
```csharp
public interface IGL{
public void Color3(ushort* p1);
public void Color3(long* p1);
}
```

**Actual behavior**
```
Microsoft (R) F# Interactive version 10.4.0 for F# 4.6
Copyright (c) Microsoft Corporation. All Rights Reserved.

For help type #help;;

> type IGL =
- abstract member Color3 : nativeptr->unit
- abstract member Color3 : nativeptr->unit
- ;;

abstract member Color3 : nativeptr->unit
--------------------^^^^^^

stdin(3,21): error FS0438: Duplicate method. The method 'Color3' has the same name and signature as another method in type 'IGL' once tuples, functions, units of measure and/or provided types are erased.
```

Provide a description of the actual behaviour observed.

**Known workarounds**

None so far.

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.