Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcCannotCallExtensionMethodInrefToByref: fix misleading error message #16082

Merged
merged 1 commit into from
Oct 10, 2023

Conversation

DedSec256
Copy link
Contributor

Let's examine the code example:

open System.Buffers

let _ =
    let reader = SequenceReader<byte>()
    let mutable totalLength = -1
    reader.TryReadBigEndian(&totalLength)

This code results in an error

image

because the actual method signature requires ref this, and byref as an additional parameter

image

This error message may be confusing because from the user perspective this parameter is passed implicitly and the first explicit parameter passed in this case is totalLength, which is passed correctly.

This PR offers a more explicit error message indicating a problem with this parameter.

@DedSec256 DedSec256 requested a review from a team as a code owner October 5, 2023 23:20
src/Compiler/FSComp.txt Show resolved Hide resolved
@T-Gro T-Gro merged commit f7913ff into dotnet:main Oct 10, 2023
25 checks passed
@DedSec256 DedSec256 deleted the dedsec256-fix-message branch October 10, 2023 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants