dotnet / dotnet/fsharp

Cannot return byref after assigning to value from an array

Open
#9,444 0 comments 1 reaction 0 assignees View on GitHub
Feature Request Needs-RFC
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.

**Repro steps**

```fsharp
let f () =
let xs = Array.zeroCreate 128
let x = &xs.[0]
&x
```

**Expected behavior**

Compiles

**Actual behavior**

Errors on `&x`

**Known workarounds**

```fsharp
let g () =
let xs = Array.zeroCreate 128
&xs.[0]

let f () =
let x = &g ()
&x
```

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.