-
Notifications
You must be signed in to change notification settings - Fork 803
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
Added inref immutability assumption removal #7407
Conversation
Almost done. Just need a few additional checks for extensions. |
If tests pass, then this is finished. |
Hi @TIHan could you review these before proceeding with this?
I believe it's the same root issue, where .NET structs are assumed to be immutable. And you're fixing this for the The code and tests look good, I really just want to double check that this is not impacting the performance of existing code that doesn't use |
Yea, I can do another review pass that them. I actually looked at both of those on Friday and it did help me. It might be the same root issue. The core of both the non-inref and inref rules are here (as of current changes): let isRecdOrStructTyconRefReadOnlyAux g m isInref (tcref: TyconRef) =
if isInref && tcref.IsILStructOrEnumTycon then
isTyconRefReadOnly g m tcref
else
isTyconRefReadOnly g m tcref || isTyconRefAssumedReadOnly g tcref I agree that we really need to be careful on existing code that does not use Concerning performance, existing Another thing that we should be doing, is disallowing |
Ok, I added tests. I was still able to reproduce @saul 's issue, but it didn't happen on the inref version. I'll look into it since I'm already doing this work. |
Thank you all for reviewing. Glad to see this get in. |
This is to resolve: #7406
Gets rid of the immutability assumption for .NET structs when it's an
inref
.Added awareness of
IsReadOnlyAttribute
on method calls from structs, only aware of IL method calls, not F# method calls. This is not a feature, but merely an optimization and will help mitigate extra warnings as a result of the immutability assumption change.