Cannot use operators defined in internal types.
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
I discovered that the compiler will not let me use an operator in an internal type, even from an internal function. I'm not sure if it's intentional, so opening it here as a bug.
**Repro steps**
```fsharp
open System
module internal M =
type C(value: int) =
static member inline (||+) (x: C, y: C) = 0
let inline internal f (x1: M.C) (x2: M.C) = x1 ||+ x2
```
**Expected behavior**
The snippet compiles successfully.
**Actual behavior**
```
error FS0043: The member or object constructor 'op_BarBarPlus' is not public. Private members may only be accessed from within the declaring type. Protected members may only be accessed from an extending type and cannot be accessed from inner lambda expressions.
```
**Known workarounds**
If I make the module public the snippet will compile successfully. I can do it in my use case (an F# library distributed in source form) and explicitly document that the types may become internal at any time.
**Related information**
Provide any related information (optional):
* .NET SDK 8.0.201
Contributor guide
Assessment
This issue has not been assessed yet.