-
Notifications
You must be signed in to change notification settings - Fork 790
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
WIP: Adding a new DataAttribute to improve specifying realsig, optimize and baselines. #18161
base: main
Are you sure you want to change the base?
Conversation
✅ No release notes required |
helper.Value () | ||
|
||
member _.Value(): CompilationUnit = | ||
let frame = StackTrace().GetFrame(1) // Get the calling method's frame |
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.
Would it be possible to use https://learn.microsoft.com/en-us/dotnet/fsharp/language-reference/caller-information instead?
Why exactly do we need it?
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.
@T-Gro , no. The Xunit.Sdk.DataAttribute.GetData override requires a MethodInfo instance. The caller-information attributes return the names of the member, the source file and line numbers.
Here is the Xunit description:
https://csharp-tokyo.github.io/xUnit-Hands-on/class_xunit_1_1_sdk_1_1_data_attribute.html#ab74ea9efe0a313e19ac0e8d8136a9071
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.
We need it, because GetData _ = is how XUnit retrieves the test data instance, and in this case we are using the DirectoryAttribute to create a compiler instance, and so we need to 'pretend' we are being xunit. It is true that our DirectoryAttribute doesn't actually use it, but we do need an instance to even invoke the method. And there is a decent probablility that at some point in the future DirectoryAttribute.GetData() will use it, so I didn't want to pass Unchecked.DefaultOf.
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.
If we reuse the functionality of DirectoryAttribute
possibly we could extract createCompilationUnit
from it into a module or maybe inherit?
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.
@majocha --- I'm still trying to figure out what we need. But we can certainly refactor, if necessary once we understand the necessities.
9111444
to
ee66618
Compare
Todo:
-[] Convert more tests to use the new attribute.