Diagnostic is unclear when passing ref readonly to ref readonly parameter using 'ref' #73459
Labels
Area-Compilers
Bug
Concept-Diagnostic Clarity
The issues deals with the ease of understanding of errors and warnings.
Milestone
Version Used: fca6e1f
Steps to Reproduce:
SharpLab
It appears that this error is by design. @jjonescz are there notes handy for why the design is this way?
Given the above I think the diagnostic message should simply be adjusted here to indicate that the user should use
in
at the call side instead.I personally found it surprising that
ref
was not permitted here, because other kinds of arguments can be passed usingref
for this parameter without issue. It was not obvious to me that usingref
was actually requiring the argument to be a writable reference, even though the parameter will not assign to the referent.The text was updated successfully, but these errors were encountered: