Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add speclet for
ref readonly
parameters #7165Add speclet for
ref readonly
parameters #7165Changes from all commits
968064a
3187bf2
e2fa3ea
95dfe7c
b7dda94
6ab4600
4dea048
ba038f4
f3deba2
f518e15
ff089cd
7426387
39a8d18
dfb6b6e
c5d9669
45ec0e9
cc0add3
0c269d2
8fa75f0
9fa0124
efcd297
2e35193
27d5b60
7a1af15
fcacbf1
a5c1f17
6b1982e
573d3e9
b4eb758
5134bd7
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean I wouldn't be able to do the following? If so, it seems a bit weird:
I was hoping we would be able to just use
ref
everywhere. It seems a bit odd to disallowref
here, since we useref
(notin
) forref readonly
locals etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes,
X1(ref c)
will be an error no matter whetherX1
is defined withref
/in
/ref readonly
parameter (the value kind ofc
is checked against theref
modifier at the callsite), you will have to useX1(in c)
whenc
is readonly. The reason is thatref
at the call site says "passing a mutable reference" whereasin
says "passing a readonly reference" -ref readonly
parameters just allow both of them.Ref assignments are special, they use
ref
always, but it's pretty clear if it's readonly or not, since that's declared right there on the left-hand side.