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

Ignore statics in metric source-gen #4843

Merged
merged 1 commit into from
Dec 29, 2023
Merged

Conversation

xakep139
Copy link
Member

@xakep139 xakep139 commented Dec 28, 2023

Fixes #4787

This PR also enables and aligns all metering tests for generated code.

Microsoft Reviewers: Open in CodeFlow

@xakep139 xakep139 added this to the 8.1 milestone Dec 28, 2023
@xakep139 xakep139 self-assigned this Dec 28, 2023
@@ -1,11 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#if false
Copy link
Member Author

Choose a reason for hiding this comment

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

Previously these tests were completely disabled 😕

@@ -96,27 +96,6 @@ class Transitive
Assert.Contains("Test.Transitive ⇆ Test.Interim", diag.GetMessage());
}

[Fact]
public async Task StrongTypeCounter_CyclicReference_Guid()
Copy link
Member Author

Choose a reason for hiding this comment

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

This test is not relevant anymore - we don't consider Guid.Empty since it's static

@@ -688,23 +686,24 @@ private void Diag(DiagnosticDescriptor desc, Location? location, params object?[
SpecialType specialType;
ITypeSymbol typeSymbol;

if (symbol.IsImplicitlyDeclared)
if (member.IsImplicitlyDeclared ||
member.IsStatic)
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the main change

@xakep139 xakep139 merged commit ac68568 into main Dec 29, 2023
6 checks passed
@xakep139 xakep139 deleted the xakep139/metric-gen-static-bug branch December 29, 2023 11:34
@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Metric generator generates tags from constant and static fields
2 participants