Skip to content

Commit 3dee2df

Browse files
committed
Remove duck type caveat
1 parent a44bda4 commit 3dee2df

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

tracer/src/Datadog.Trace.Tools.Analyzers/SealedAnalyzer/SealedAnalyzer.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ private static void OnCompilationStart(CompilationStartAnalysisContext context)
3636
var attributesToMatch = new[]
3737
{
3838
context.Compilation.GetOrCreateTypeByMetadataName("System.Runtime.InteropServices.ComImportAttribute"),
39-
context.Compilation.GetOrCreateTypeByMetadataName("Datadog.Trace.DuckTyping.DuckTypeAttribute")
4039
};
4140

4241
var candidateTypes = PooledConcurrentSet<INamedTypeSymbol>.GetInstance(SymbolEqualityComparer.Default);

tracer/test/Datadog.Trace.Tools.Analyzers.Tests/SealedAnalyzer/SealedAnalyzerTests.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -215,31 +215,18 @@ public async Task UnsealedNestedClassTwoDeep_Diagnostic(
215215

216216
[Theory]
217217
[CombinatorialData]
218-
public async Task DuckTypeAttributedType_NoDiagnostic(
219-
[CombinatorialMemberData(nameof(NonPrivateModifiers))] string modifier,
220-
[CombinatorialMemberData(nameof(ClassTypes))] string type)
218+
public async Task AttributedType_NoDiagnostic(
219+
[CombinatorialMemberData(nameof(NonPrivateModifiers))] string modifier)
221220
{
222221
var source =
223222
$$"""
224223
using System;
225-
using Datadog.Trace.DuckTyping;
226224
227-
[Datadog.Trace.DuckTyping.DuckType("Sometype", "SomeAssembly")]
228-
[DuckType("Sometype", "SomeAssembly")]
229-
{{modifier}}{{type}} C
225+
[System.Runtime.InteropServices.ComImport]
226+
[System.Runtime.InteropServices.Guid("E8D59775-E821-4D6C-B63D-BB0D969361DA")]
227+
{{modifier}}class C
230228
{
231229
}
232-
233-
namespace Datadog.Trace.DuckTyping
234-
{
235-
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true)]
236-
internal sealed class DuckTypeAttribute(string targetType, string targetAssembly) : Attribute
237-
{
238-
public string? TargetType { get; set; } = targetType;
239-
240-
public string? TargetAssembly { get; set; } = targetAssembly;
241-
}
242-
}
243230
""";
244231

245232
await Verifier.VerifyAnalyzerAsync(source); // no diagnostics expected

0 commit comments

Comments
 (0)