Skip to content

Emitting IsReadOnlyAttribute on return arguments of type inref<_>#10022

Merged
cartermp merged 3 commits intodotnet:mainfrom
TIHan:fix-inref-return
Sep 9, 2020
Merged

Emitting IsReadOnlyAttribute on return arguments of type inref<_>#10022
cartermp merged 3 commits intodotnet:mainfrom
TIHan:fix-inref-return

Conversation

@TIHan
Copy link
Copy Markdown
Contributor

@TIHan TIHan commented Aug 27, 2020

Resolves this: #9997 (comment)

Pretty straight forward, though a little awkward due to passing an ILType and a TType.

@TIHan
Copy link
Copy Markdown
Contributor Author

TIHan commented Sep 3, 2020

@dsyme this look ok? Wondering if there is an alternative to stripFunTy g vref.Type.

@cartermp cartermp requested a review from dsyme September 4, 2020 01:28
Comment thread src/fsharp/IlxGen.fs Outdated

assert witnessInfos.IsEmpty

let _, retTy = stripFunTy g vref.Type
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will fail for generic methods. Instead, notice that GetMethodSpecForMemberVal is already cracking the returnTy, so return returnTy from that and collect it 4 lines above.

@dsyme
Copy link
Copy Markdown
Contributor

dsyme commented Sep 4, 2020

@TIHan I left a note, there's an easy alternative to using stripFunTy. You might also check generic abstract methods. in testing

Copy link
Copy Markdown
Contributor

@dsyme dsyme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TIHan I left a note, there's an easy alternative to using stripFunTy. You might also check generic abstract methods. in testing

@TIHan
Copy link
Copy Markdown
Contributor Author

TIHan commented Sep 4, 2020

Thanks, I will make those changes. I knew stripFunTy didn't feel right.

@cartermp cartermp requested a review from dsyme September 9, 2020 05:37
@cartermp cartermp merged commit 004b189 into dotnet:main Sep 9, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
…tnet#10022)

* Emitting IsReadOnlyAttribute on return arguments of type inref<_>

* Emitting modreq(InAttribute) on property type and emitting IsReadOnlyAttribute on property

* Correctly getting return type. Added more tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants