-
Notifications
You must be signed in to change notification settings - Fork 802
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Adding a new DataAttribute to improve specifying realsig, optimize and baselines. #18161
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
1e413e8
to
5d7fe2b
Compare
@@ -242,7 +242,7 @@ type CompilationUtil private () = | |||
with | |||
| _ -> (errors, [||]) | |||
finally | |||
try Directory.Delete(Path.GetDirectoryName ilFilePath, true) with _ -> () | |||
() //try Directory.Delete(Path.GetDirectoryName ilFilePath, true) with _ -> () |
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.
Ping.
try | ||
Directory.Delete(initialProject.ProjectDir, true) | ||
with _ -> () | ||
() //try Directory.Delete(initialProject.ProjectDir, true) with _ -> () |
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 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.
That is temporary, although I think I will add an an environment variable to turn off deletes.
@@ -1,202 +0,0 @@ | |||
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. | |||
|
|||
namespace Conformance.Conformance.DeclarationElements.CustomAttributes.AttributeUsage |
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.
Where did those go?
Can you please help with making the review surface more manageable? I see some file re-orgs, file renames as well as bulk (regex?) changes of attribute usage. |
What I can do is split it into a few PR's.
The only change I really care about is the new attribute and the refactor. How does that sound? |
b370561
to
403c43c
Compare
403c43c
to
7a713b3
Compare
…18195) * refactor * tests/FSharp.Compiler.ComponentTests/EmittedIL/ForLoop
…18196) * More tests - directory attribute improvements * methordresolution
Todo:
-[] Convert more tests to use the new attribute.