Skip to content

Commit de831d1

Browse files
committed
C#: Add inline type array test.
1 parent 8a97c8c commit de831d1

File tree

4 files changed

+32
-0
lines changed

4 files changed

+32
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| types.cs:60:19:60:31 | MyInlineArray | Int32 | 1 | 10 |
2+
| types.cs:66:19:66:47 | MyMultiDimensionalInlineArray | MyInlineArray | 2 | 5 |
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import csharp
2+
3+
from InlineArrayType t
4+
where t.fromSource()
5+
select t, t.getElementType().toString(), t.getDimension(), t.getLength()

csharp/ql/test/library-tests/types/PrintAst.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,17 @@ types.cs:
107107
#-----| 1: (Type parameters)
108108
# 57| 0: [TypeParameter] U
109109
# 57| 1: [TypeParameter] V
110+
# 60| 10: [InlineArrayType] MyInlineArray
111+
#-----| 0: (Attributes)
112+
# 59| 1: [DefaultAttribute] [InlineArray(...)]
113+
# 59| -1: [TypeMention] InlineArrayAttribute
114+
# 59| 0: [IntLiteral] 10
115+
# 62| 5: [Field] myInlineArrayElements
116+
# 62| -1: [TypeMention] int
117+
# 66| 11: [InlineArrayType] MyMultiDimensionalInlineArray
118+
#-----| 0: (Attributes)
119+
# 65| 1: [DefaultAttribute] [InlineArray(...)]
120+
# 65| -1: [TypeMention] InlineArrayAttribute
121+
# 65| 0: [IntLiteral] 5
122+
# 68| 5: [Field] myMultiDimentionalInlineArrayElements
123+
# 68| -1: [TypeMention] MyInlineArray

csharp/ql/test/library-tests/types/types.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,15 @@ interface GenericInterface<T> { }
5656
struct GenericStruct<T> { }
5757
class Map<U, V> { }
5858

59+
[System.Runtime.CompilerServices.InlineArray(10)]
60+
public struct MyInlineArray
61+
{
62+
private int myInlineArrayElements;
63+
}
64+
65+
[System.Runtime.CompilerServices.InlineArray(5)]
66+
public struct MyMultiDimensionalInlineArray
67+
{
68+
private MyInlineArray myMultiDimentionalInlineArrayElements;
69+
}
5970
}

0 commit comments

Comments
 (0)