Skip to content
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

Get CallerArgumentExpression ready #54839

Merged

Conversation

Youssef1313
Copy link
Member

@Youssef1313 Youssef1313 commented Jul 15, 2021

Proposal: dotnet/csharplang#287
Test plan: #52745

@333fred @jcouv for review.

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 3)

@Youssef1313
Copy link
Member Author

Ping @333fred for review.

@333fred
Copy link
Member

333fred commented Jul 19, 2021

We went through the compiler test plan review today. Overall, it looks good, but we'd like to see some tests around the "Compiler generated calls with user-written code" bullet before we merge to main. @Youssef1313 do you think you can add them to this PR? Test plan is here: #52745

@@ -108,7 +108,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Syntax.InternalSyntax
Return LanguageVersion.VisualBasic16_9

Case Feature.CallerArgumentExpression
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this actually checked anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@333fred If you mean tests, there is TestGoodCallerArgumentExpressionAttribute_Version16_9 that tests old version. If you mean in product code, it's checked here:

InternalSyntax.Parser.CheckFeatureAvailability(diagnostics,
argumentSyntax.Location,
DirectCast(argumentSyntax.SyntaxTree.Options, VisualBasicParseOptions).LanguageVersion,
InternalSyntax.Feature.CallerArgumentExpression)

@jcouv jcouv self-assigned this Jul 20, 2021
@Youssef1313
Copy link
Member Author

We went through the compiler test plan review today. Overall, it looks good, but we'd like to see some tests around the "Compiler generated calls with user-written code" bullet before we merge to main. @Youssef1313 do you think you can add them to this PR? Test plan is here: #52745

Yes I'll add them in this PR.

@@ -266,6 +267,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Symbols

Friend Overrides Iterator Function GetCustomAttributesToEmit(compilationState As ModuleCompilationState) As IEnumerable(Of VisualBasicAttributeData)
Dim attributes = MyBase.GetCustomAttributesToEmit(compilationState)

If Not Location.SourceTree.Options.Features.ContainsKey(InternalSyntax.GetFeatureFlag(InternalSyntax.Feature.CallerArgumentExpression)) Then
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@333fred It looks like SourceTree can be null. I'm not sure what to do for the null case, allow the feature to work or emit the attributes as is?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should emit the attribute as is in those cases. I imagine most those will be synthesized parameters, and thus not likely to have this attribute in the first place?

Log(123)
~~~
</expected>)
Dim compilation = CreateCompilation(source, targetFramework:=TargetFramework.NetCoreApp, references:={Net451.MicrosoftVisualBasic}, options:=TestOptions.ReleaseExe, parseOptions:=TestOptions.Regular16_9.WithFeature("CallerArgumentExpression"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than modifying this test to succeed, let's leave the feature flag off and verify the behavior when it's not present.

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a couple of small things left. We're really close!

Copy link
Member

@333fred 333fred left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (commit 10). Just one thing to remove the unshipped api txt file. @jcouv, please take another look.

@@ -233,12 +233,12 @@ End Module
</file>
</compilation>

Dim compilation = CreateCompilationWithCustomILSource(source, il, options:=TestOptions.ReleaseExe, includeVbRuntime:=True, parseOptions:=TestOptions.RegularLatest)
Dim compilation = CreateCompilationWithCustomILSource(source, il, options:=TestOptions.ReleaseExe, includeVbRuntime:=True, parseOptions:=TestOptions.RegularLatest.WithFeature("CallerArgumentExpression"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: it may have been good to have a test with feature flag and an earlier version, to illustrate the the feature works on old language versions

Copy link
Member

@jcouv jcouv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM Thanks (iteration 10)

@jcouv
Copy link
Member

jcouv commented Jul 22, 2021

@333fred How do you want to track the removal of feature flag? We can either use the test plan (keep it open for now) or open a separate issue.

@333fred
Copy link
Member

333fred commented Jul 22, 2021

@333fred How do you want to track the removal of feature flag? We can either use the test plan (keep it open for now) or open a separate issue.

I'd say let's use the test plan.

Edit: I've updated the test plan with a bullet.

@jcouv
Copy link
Member

jcouv commented Jul 22, 2021

Correctness leg fails with:

src\Compilers\VisualBasic\Portable\PublicAPI.Unshipped.txt(2,1): error RS0017: (NETCORE_ENGINEERING_TELEMETRY=Build) Symbol 'Microsoft.CodeAnalysis.VisualBasic.LanguageVersion.VisualBasic17 = 1700 -> Microsoft.CodeAnalysis.VisualBasic.LanguageVersion' is part of the declared API, but is either not public or could not be found

@jcouv jcouv merged commit faecd02 into dotnet:features/caller-argument-expression Jul 23, 2021
@jcouv
Copy link
Member

jcouv commented Jul 23, 2021

Merged/squashed. Thanks @Youssef1313

@Youssef1313 Youssef1313 deleted the final-edits branch July 23, 2021 06:33
@Youssef1313
Copy link
Member Author

@jcouv @333fred Is the feature ready to merge into main?

@333fred
Copy link
Member

333fred commented Jul 23, 2021

@jcouv @333fred Is the feature ready to merge into main?

Yep. I'll be working on that today/Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants