-
Notifications
You must be signed in to change notification settings - Fork 128
Test that basic ref field operations don't crash linker #2952
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
Conversation
delegate ref RS2 RefRSParamRefRs2Return (ref RS rs); | ||
delegate ref int RsParamRefIntReturn (RS rs); | ||
|
||
public static void Main (string[] args) |
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.
I actually don't know if some of these are valid, but still:
- ref struct in a generic parameter
- ref return and parameter on a virtual method?
- Put annotations (DAM/RUC on type) on the ref field - don't care if it works correctly, but should not crash
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.
ref struct in a generic parameter
Ref structs will generate CS0306 if used as a type parameter.
ref return and parameter on a virtual method?
Added IRS interface and Base and Derived classes with virtual methods with ref structs as return, ref return, parameter, and ref parameter.
Put annotations (DAM/RUC on type) on the ref field
RUC can't be placed on structs and ref structs can't implement interfaces, so I don't think there's a way that they could be annotated with DAM. I've added DAM on a field and DAM and RUC on a method return and parameter.
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.
Thanks a lot!
- Add virtual methods with ref structs - Add fields with DAM - Add method with ref structs with RUC and DAM
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.
Thanks!
using Mono.Linker.Tests.Cases.Expectations.Helpers; | ||
|
||
namespace Mono.Linker.Tests.Cases.Basic | ||
{ |
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.
Nit: Add a comment describing what the test is trying to validate - mainly that it's only meant to validate that linker doesn't crash or do other weird things on ref fields. And that it's not meant as full validation of all functionality around ref fields.
…r#2952) Adds test to use ref fields in various ways to confirm that they don't cause the linker to crash. Commit migrated from dotnet/linker@d9aebf3
Adds some tests with basic usage of ref fields to ensure the linker doesn't crash or produce incorrect warnings. Ref structs can't be used as type parameters, so some things like IEnumerable can't be tested.
Please let me know if I'm missing other cases where this could cause some issues.