Skip to content

Commit d5ee93d

Browse files
committed
C#: Anonymous types should not be considered unknown.
1 parent 3b764b0 commit d5ee93d

File tree

1 file changed

+4
-1
lines changed
  • csharp/extractor/Semmle.Extraction.CSharp/Entities/Types

1 file changed

+4
-1
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Types/Type.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@ public static bool ConstructedOrParentIsConstructed(INamedTypeSymbol symbol)
3131
/// <param name="symbol">Type symbol</param>
3232
private bool IsBrokenType(ITypeSymbol symbol)
3333
{
34-
if (!Context.ExtractionContext.IsStandalone || !symbol.FromSource())
34+
if (!Context.ExtractionContext.IsStandalone ||
35+
!symbol.FromSource() ||
36+
symbol.IsAnonymousType)
3537
{
3638
return false;
3739
}
40+
3841
// (1) public class { ... } is a broken type and doesn't have a name.
3942
// (2) public class var { ... } is a an allowed type, but it overrides the var keyword for all uses.
4043
// It is probably a better heuristic to treat it as a broken type.

0 commit comments

Comments
 (0)