-
Couldn't load subscription status.
- Fork 379
Updating GenAPI to support static abstracts in interfaces and user-defined checked operators #8769
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
…e for the keyword
… are implicitly implemented
|
Some example diffs. Previously the "full name" would be used in the corresponding primitive type, there is no need for this and it makes the code needlessly different from the source (e.g. - public int CompareTo(System.Boolean value) { throw null; }
+ public int CompareTo(bool value) { throw null; }Implementations of static abstract members are now correctly processed: - static System.Byte CreateChecked<TOther>(TOther value) { throw null; }
+ public static byte CreateChecked<TOther>(TOther value) where TOther : System.Numerics.INumber<TOther> { throw null; }Static abstract operators are now correctly named: - static System.Byte System.Numerics.IAdditionOperators<System.Byte,System.Byte,System.Byte>.op_Addition(System.Byte left, System.Byte right) { throw null; }
+ static byte System.Numerics.IAdditionOperators<byte, byte, byte>.operator +(byte left, byte right) { throw null; } |
|
CC. @adiaaida, @ericstj |
| var useKeywords = containingType.GetTypeName() != type.GetTypeName(); | ||
|
|
||
| WriteTypeName(type, attributes: attributes, useTypeKeywords: useKeywords, methodNullableContextValue: methodNullableContextValue); | ||
| WriteTypeName(type, attributes: attributes, methodNullableContextValue: methodNullableContextValue); |
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.
there is no need for this and it makes the code needlessly different from the source
I agree that the change makes things more readable. I wonder if there was any reason behind why it does what it does because someone went out of their way to do that. It's been this way since open sourced, but you might be able to see history in the fxcore repository.
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 wonder if there was any reason behind why it does what it does because someone went out of their way to do that
AFAIK, there is no reason to ever not prefer the language keyword (modulo using aliases). If there was, I would expect we'd have the same requirement in our actual source implementation.
|
Is this still pending any changes or can it be merged? |
|
Spoke about your PR with @ericstj yesterday and he offered to help. Unfortunately I can't add any value here as I don't know much about CCI. |
|
This code change looks ok to me. We don't get great test coverage of this so I had the following suggestion. Run genapi on the bin directory of dotnet/runtime using the tool prior to this change and after, then diff the result. That can help you understand that your change supports all the places we use it in dotnet/runtime and the diff can make sure you aren't adding any unexpected changes. I put together a gist of the script to do this: https://gist.github.com/ericstj/1047b60e51dad611d34a72d645b07c9f @tannergooding can you please review that and make sure all the changes look right to you? It would also be good to test that consuming this for System.Runtime is working as expected. I didn't go so far as to do that. I tried to compile the output of System.Private.CoreLib.cs and hit a stack-overflow in the compiler but I hit that both before and after your change so its likely something else. |
All the checked in generic-math changes from the past few weeks have been generated using this as the basis, so I'm confident its working as intended.
I'm not 100% on the System.Private.Corelib looks correct. |
|
@ericstj anything else needed here or are we good to merge? |
|
Ok, lets give this a try. TFTF @tannergooding |
This resolves #8639
This resolves #8638