-
Couldn't load subscription status.
- Fork 128
Share MakeGeneric.. and Expression.Call #2758
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
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.
LGTM
| } | ||
|
|
||
| [ExpectedWarning ("IL2060", nameof (MethodInfo.MakeGenericMethod))] | ||
| // https://github.com/dotnet/linker/issues/2158 - analyzer doesn't work the same as linker, it simply doesn't handle refs |
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.
Could this actually be #2680?
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.
Kind of both - I think we need ref tracking in order to implement array reset in this case.
| } | ||
| // We haven't found any generic parameters with annotations, so there's nothing to validate. | ||
| } else if (value == NullValue.Instance) { | ||
| // Do nothing - null value is valid and should not cause warnings nor marking |
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.
It looks like the null case will effectively return null, should that be fixed to return TopValue?
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.
You're right. The end result is the same since any reflection API will ignore the null on input anyway, but it's better to track it as empty here.
And the comment is wrong. MakeGenericType throws if "this" is null - obviously :-)
Co-authored-by: Sven Boemer <[email protected]>
Moves the intrinsic handling of `MakeGenericType`, `MakeGenericMethod` and `Expression.Call` into the shared code. Other changes: * Some small refactorings on the shared type system and value system. * Expose generic parameters on type system proxies * Fix a bug in analyzer when we're recording patterns, the values must be cloned (as they can mutate during analysis after the record is taken) * Fix some problems in Nullable<T> handling in MakeGenericType - specifically if we don't know what the T is going to be, we now return just Nullable<> known type (but unknown T). * Add couple new tests - update existing ones (mainly due to limitation in the analyzer) Co-authored-by: Sven Boemer <[email protected]> Commit migrated from dotnet/linker@bf4d43b
Moves the intrinsic handling of
MakeGenericType,MakeGenericMethodandExpression.Callinto the shared code.Other changes: