dotnet / dotnet/fsharp

AutoOpen and RequireQualifiedAccess can both be specified on a module

Open
#7,403 2 comments 0 reactions 0 assignees View on GitHub
Area-Diagnostics Feature Improvement
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 11h
Merged PRs (30d)
131

Description

Consider the following code:

```fsharp
[]
module M =
let f x = ()

f 12 // Compiles!
```

Now consider this code:

```fsharp
[]
module M =
let f x = ()

open M // Compile error!

f 12
```

In the second example, we cannot `open M` because of the `RequireQualifiedAccess` attribute.

However, we can get around that by plopping `AutoOpen` in the attribute list and removing the `open M` declaration.

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.