Skip to content

Commit bb49fe1

Browse files
committed
C# extractor: Handle the type name of dynamic.
1 parent 185700a commit bb49fe1

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

csharp/extractor/Semmle.Extraction.CSharp/Entities/Expressions/Name.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public static Expression Create(ExpressionNodeInfo info)
4343
{
4444
case SymbolKind.TypeParameter:
4545
case SymbolKind.NamedType:
46+
case SymbolKind.DynamicType:
4647
return TypeAccess.Create(info);
4748

4849
case SymbolKind.Property:

csharp/ql/test/library-tests/regressions/Program.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,18 @@ void F()
119119
new Point { x=1, y=2 };
120120
}
121121
}
122+
123+
class DynamicType
124+
{
125+
void F()
126+
{
127+
dynamic t = (dynamic)null;
128+
}
129+
}
130+
131+
class LocalVariableTags
132+
{
133+
Func<int, int> F = x => { int y=x; return y; };
134+
}
135+
136+
// semmle-extractor-options: /r:System.Dynamic.Runtime.dll

csharp/ql/test/library-tests/regressions/TypeMentions.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@
5252
| Program.cs:114:16:114:19 | Nullable<Int32> |
5353
| Program.cs:117:5:117:8 | Void |
5454
| Program.cs:119:13:119:17 | Point |
55+
| Program.cs:125:5:125:8 | Void |
56+
| Program.cs:127:9:127:15 | dynamic |
57+
| Program.cs:127:22:127:28 | dynamic |
58+
| Program.cs:133:5:133:8 | Func<Int32,Int32> |
59+
| Program.cs:133:10:133:12 | Int32 |
60+
| Program.cs:133:15:133:17 | Int32 |
61+
| Program.cs:133:31:133:33 | Int32 |

0 commit comments

Comments
 (0)