Skip to content

Commit 363dd49

Browse files
committed
C#: Add explicit interface implementation examples and update expected test output.
1 parent 0dc6ada commit 363dd49

File tree

3 files changed

+315
-122
lines changed

3 files changed

+315
-122
lines changed

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

Lines changed: 254 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,136 +1051,280 @@ StaticInterfaceMembers.cs:
10511051
# 5| 0: [Parameter] other
10521052
# 5| -1: [TypeMention] T
10531053
# 5| 4: [ParameterAccess] access to parameter other
1054-
# 7| 6: [Method] Add
1054+
# 7| 6: [AddOperator] +
10551055
# 7| -1: [TypeMention] T
10561056
#-----| 2: (Parameters)
10571057
# 7| 0: [Parameter] left
10581058
# 7| -1: [TypeMention] T
10591059
# 7| 1: [Parameter] right
10601060
# 7| -1: [TypeMention] T
1061-
# 9| 7: [Method] Subtract
1061+
# 9| 7: [SubOperator] -
10621062
# 9| -1: [TypeMention] T
10631063
#-----| 2: (Parameters)
10641064
# 9| 0: [Parameter] left
10651065
# 9| -1: [TypeMention] T
10661066
# 9| 1: [Parameter] right
10671067
# 9| -1: [TypeMention] T
10681068
# 9| 4: [ParameterAccess] access to parameter left
1069-
# 11| 8: [Method] Zero
1070-
# 11| -1: [TypeMention] T
1071-
# 11| 4: [DefaultValueExpr] default(...)
1072-
# 11| 0: [TypeAccess] access to type T
1073-
# 11| 0: [TypeMention] T
1074-
# 14| [Class] Complex
1069+
# 11| 8: [ExplicitConversionOperator] explicit conversion
1070+
# 11| -1: [TypeMention] int
1071+
#-----| 2: (Parameters)
1072+
# 11| 0: [Parameter] n
1073+
# 11| -1: [TypeMention] T
1074+
# 13| 9: [ExplicitConversionOperator] explicit conversion
1075+
# 13| -1: [TypeMention] short
1076+
#-----| 2: (Parameters)
1077+
# 13| 0: [Parameter] n
1078+
# 13| -1: [TypeMention] T
1079+
# 15| 10: [Method] Inc
1080+
# 15| -1: [TypeMention] T
1081+
#-----| 2: (Parameters)
1082+
# 15| 0: [Parameter] other
1083+
# 15| -1: [TypeMention] T
1084+
# 17| 11: [Method] Dec
1085+
# 17| -1: [TypeMention] T
1086+
#-----| 2: (Parameters)
1087+
# 17| 0: [Parameter] other
1088+
# 17| -1: [TypeMention] T
1089+
# 17| 4: [ParameterAccess] access to parameter other
1090+
# 19| 12: [Method] Add
1091+
# 19| -1: [TypeMention] T
1092+
#-----| 2: (Parameters)
1093+
# 19| 0: [Parameter] left
1094+
# 19| -1: [TypeMention] T
1095+
# 19| 1: [Parameter] right
1096+
# 19| -1: [TypeMention] T
1097+
# 21| 13: [Method] Subtract
1098+
# 21| -1: [TypeMention] T
1099+
#-----| 2: (Parameters)
1100+
# 21| 0: [Parameter] left
1101+
# 21| -1: [TypeMention] T
1102+
# 21| 1: [Parameter] right
1103+
# 21| -1: [TypeMention] T
1104+
# 21| 4: [ParameterAccess] access to parameter left
1105+
# 23| 14: [Method] Zero
1106+
# 23| -1: [TypeMention] T
1107+
# 23| 4: [DefaultValueExpr] default(...)
1108+
# 23| 0: [TypeAccess] access to type T
1109+
# 23| 0: [TypeMention] T
1110+
# 26| [Class] Complex
10751111
#-----| 3: (Base types)
1076-
# 16| 4: [Property] Real
1077-
# 16| -1: [TypeMention] double
1078-
# 16| 2: [AssignExpr] ... = ...
1079-
# 16| 0: [PropertyCall] access to property Real
1080-
# 16| 1: [DoubleLiteral] 0
1081-
# 16| 3: [Getter] get_Real
1082-
# 16| 4: [Setter] set_Real
1112+
# 28| 4: [Property] Real
1113+
# 28| -1: [TypeMention] double
1114+
# 28| 2: [AssignExpr] ... = ...
1115+
# 28| 0: [PropertyCall] access to property Real
1116+
# 28| 1: [DoubleLiteral] 0
1117+
# 28| 3: [Getter] get_Real
1118+
# 28| 4: [Setter] set_Real
10831119
#-----| 2: (Parameters)
1084-
# 16| 0: [Parameter] value
1085-
# 17| 5: [Property] Imaginary
1086-
# 17| -1: [TypeMention] double
1087-
# 17| 2: [AssignExpr] ... = ...
1088-
# 17| 0: [PropertyCall] access to property Imaginary
1089-
# 17| 1: [DoubleLiteral] 0
1090-
# 17| 3: [Getter] get_Imaginary
1091-
# 17| 4: [Setter] set_Imaginary
1120+
# 28| 0: [Parameter] value
1121+
# 29| 5: [Property] Imaginary
1122+
# 29| -1: [TypeMention] double
1123+
# 29| 2: [AssignExpr] ... = ...
1124+
# 29| 0: [PropertyCall] access to property Imaginary
1125+
# 29| 1: [DoubleLiteral] 0
1126+
# 29| 3: [Getter] get_Imaginary
1127+
# 29| 4: [Setter] set_Imaginary
10921128
#-----| 2: (Parameters)
1093-
# 17| 0: [Parameter] value
1094-
# 19| 6: [InstanceConstructor] Complex
1095-
# 19| 4: [BlockStmt] {...}
1096-
# 21| 7: [Method] Zero
1097-
# 21| -1: [TypeMention] Complex
1098-
# 21| 4: [ObjectCreation] object creation of type Complex
1099-
# 21| 0: [TypeMention] Complex
1100-
# 23| 8: [IncrementOperator] ++
1101-
# 23| -1: [TypeMention] Complex
1129+
# 29| 0: [Parameter] value
1130+
# 31| 6: [InstanceConstructor] Complex
1131+
# 31| 4: [BlockStmt] {...}
1132+
# 33| 7: [Method] Zero
1133+
# 33| -1: [TypeMention] Complex
1134+
# 33| 4: [ObjectCreation] object creation of type Complex
1135+
# 33| 0: [TypeMention] Complex
1136+
# 35| 8: [IncrementOperator] ++
1137+
# 35| -1: [TypeMention] Complex
11021138
#-----| 2: (Parameters)
1103-
# 23| 0: [Parameter] other
1104-
# 23| -1: [TypeMention] Complex
1105-
# 24| 4: [ObjectCreation] object creation of type Complex
1106-
# 24| -2: [TypeMention] Complex
1107-
# 24| -1: [ObjectInitializer] { ..., ... }
1108-
# 24| 0: [MemberInitializer] ... = ...
1109-
# 24| 0: [PropertyCall] access to property Real
1110-
# 24| 1: [AddExpr] ... + ...
1111-
# 24| 0: [PropertyCall] access to property Real
1112-
# 24| -1: [ParameterAccess] access to parameter other
1113-
# 24| 1: [DoubleLiteral] 1
1114-
# 24| 1: [MemberInitializer] ... = ...
1115-
# 24| 0: [PropertyCall] access to property Imaginary
1116-
# 24| 1: [PropertyCall] access to property Imaginary
1117-
# 24| -1: [ParameterAccess] access to parameter other
1118-
# 26| 9: [DecrementOperator] --
1119-
# 26| -1: [TypeMention] Complex
1139+
# 35| 0: [Parameter] other
1140+
# 35| -1: [TypeMention] Complex
1141+
# 36| 4: [ObjectCreation] object creation of type Complex
1142+
# 36| -2: [TypeMention] Complex
1143+
# 36| -1: [ObjectInitializer] { ..., ... }
1144+
# 36| 0: [MemberInitializer] ... = ...
1145+
# 36| 0: [PropertyCall] access to property Real
1146+
# 36| 1: [AddExpr] ... + ...
1147+
# 36| 0: [PropertyCall] access to property Real
1148+
# 36| -1: [ParameterAccess] access to parameter other
1149+
# 36| 1: [DoubleLiteral] 1
1150+
# 36| 1: [MemberInitializer] ... = ...
1151+
# 36| 0: [PropertyCall] access to property Imaginary
1152+
# 36| 1: [PropertyCall] access to property Imaginary
1153+
# 36| -1: [ParameterAccess] access to parameter other
1154+
# 38| 9: [DecrementOperator] --
1155+
# 38| -1: [TypeMention] Complex
11201156
#-----| 2: (Parameters)
1121-
# 26| 0: [Parameter] other
1122-
# 26| -1: [TypeMention] Complex
1123-
# 27| 4: [ObjectCreation] object creation of type Complex
1124-
# 27| -2: [TypeMention] Complex
1125-
# 27| -1: [ObjectInitializer] { ..., ... }
1126-
# 27| 0: [MemberInitializer] ... = ...
1127-
# 27| 0: [PropertyCall] access to property Real
1128-
# 27| 1: [SubExpr] ... - ...
1129-
# 27| 0: [PropertyCall] access to property Real
1130-
# 27| -1: [ParameterAccess] access to parameter other
1131-
# 27| 1: [DoubleLiteral] 1
1132-
# 27| 1: [MemberInitializer] ... = ...
1133-
# 27| 0: [PropertyCall] access to property Imaginary
1134-
# 27| 1: [PropertyCall] access to property Imaginary
1135-
# 27| -1: [ParameterAccess] access to parameter other
1136-
# 29| 10: [Method] Add
1137-
# 29| -1: [TypeMention] Complex
1157+
# 38| 0: [Parameter] other
1158+
# 38| -1: [TypeMention] Complex
1159+
# 39| 4: [ObjectCreation] object creation of type Complex
1160+
# 39| -2: [TypeMention] Complex
1161+
# 39| -1: [ObjectInitializer] { ..., ... }
1162+
# 39| 0: [MemberInitializer] ... = ...
1163+
# 39| 0: [PropertyCall] access to property Real
1164+
# 39| 1: [SubExpr] ... - ...
1165+
# 39| 0: [PropertyCall] access to property Real
1166+
# 39| -1: [ParameterAccess] access to parameter other
1167+
# 39| 1: [DoubleLiteral] 1
1168+
# 39| 1: [MemberInitializer] ... = ...
1169+
# 39| 0: [PropertyCall] access to property Imaginary
1170+
# 39| 1: [PropertyCall] access to property Imaginary
1171+
# 39| -1: [ParameterAccess] access to parameter other
1172+
# 41| 10: [AddOperator] +
1173+
# 41| -1: [TypeMention] Complex
11381174
#-----| 2: (Parameters)
1139-
# 29| 0: [Parameter] left
1140-
# 29| -1: [TypeMention] Complex
1141-
# 29| 1: [Parameter] right
1142-
# 29| -1: [TypeMention] Complex
1143-
# 30| 4: [ObjectCreation] object creation of type Complex
1144-
# 30| -2: [TypeMention] Complex
1145-
# 30| -1: [ObjectInitializer] { ..., ... }
1146-
# 30| 0: [MemberInitializer] ... = ...
1147-
# 30| 0: [PropertyCall] access to property Real
1148-
# 30| 1: [AddExpr] ... + ...
1149-
# 30| 0: [PropertyCall] access to property Real
1150-
# 30| -1: [ParameterAccess] access to parameter left
1151-
# 30| 1: [PropertyCall] access to property Real
1152-
# 30| -1: [ParameterAccess] access to parameter right
1153-
# 30| 1: [MemberInitializer] ... = ...
1154-
# 30| 0: [PropertyCall] access to property Imaginary
1155-
# 30| 1: [AddExpr] ... + ...
1156-
# 30| 0: [PropertyCall] access to property Imaginary
1157-
# 30| -1: [ParameterAccess] access to parameter left
1158-
# 30| 1: [PropertyCall] access to property Imaginary
1159-
# 30| -1: [ParameterAccess] access to parameter right
1160-
# 32| 11: [Method] Subtract
1161-
# 32| -1: [TypeMention] Complex
1175+
# 41| 0: [Parameter] left
1176+
# 41| -1: [TypeMention] Complex
1177+
# 41| 1: [Parameter] right
1178+
# 41| -1: [TypeMention] Complex
1179+
# 42| 4: [ObjectCreation] object creation of type Complex
1180+
# 42| -2: [TypeMention] Complex
1181+
# 42| -1: [ObjectInitializer] { ..., ... }
1182+
# 42| 0: [MemberInitializer] ... = ...
1183+
# 42| 0: [PropertyCall] access to property Real
1184+
# 42| 1: [AddExpr] ... + ...
1185+
# 42| 0: [PropertyCall] access to property Real
1186+
# 42| -1: [ParameterAccess] access to parameter left
1187+
# 42| 1: [PropertyCall] access to property Real
1188+
# 42| -1: [ParameterAccess] access to parameter right
1189+
# 42| 1: [MemberInitializer] ... = ...
1190+
# 42| 0: [PropertyCall] access to property Imaginary
1191+
# 42| 1: [AddExpr] ... + ...
1192+
# 42| 0: [PropertyCall] access to property Imaginary
1193+
# 42| -1: [ParameterAccess] access to parameter left
1194+
# 42| 1: [PropertyCall] access to property Imaginary
1195+
# 42| -1: [ParameterAccess] access to parameter right
1196+
# 44| 11: [SubOperator] -
1197+
# 44| -1: [TypeMention] Complex
11621198
#-----| 2: (Parameters)
1163-
# 32| 0: [Parameter] left
1164-
# 32| -1: [TypeMention] Complex
1165-
# 32| 1: [Parameter] right
1166-
# 32| -1: [TypeMention] Complex
1167-
# 33| 4: [ObjectCreation] object creation of type Complex
1168-
# 33| -2: [TypeMention] Complex
1169-
# 33| -1: [ObjectInitializer] { ..., ... }
1170-
# 33| 0: [MemberInitializer] ... = ...
1171-
# 33| 0: [PropertyCall] access to property Real
1172-
# 33| 1: [SubExpr] ... - ...
1173-
# 33| 0: [PropertyCall] access to property Real
1174-
# 33| -1: [ParameterAccess] access to parameter left
1175-
# 33| 1: [PropertyCall] access to property Real
1176-
# 33| -1: [ParameterAccess] access to parameter right
1177-
# 33| 1: [MemberInitializer] ... = ...
1178-
# 33| 0: [PropertyCall] access to property Imaginary
1179-
# 33| 1: [SubExpr] ... - ...
1180-
# 33| 0: [PropertyCall] access to property Imaginary
1181-
# 33| -1: [ParameterAccess] access to parameter left
1182-
# 33| 1: [PropertyCall] access to property Imaginary
1183-
# 33| -1: [ParameterAccess] access to parameter right
1199+
# 44| 0: [Parameter] left
1200+
# 44| -1: [TypeMention] Complex
1201+
# 44| 1: [Parameter] right
1202+
# 44| -1: [TypeMention] Complex
1203+
# 45| 4: [ObjectCreation] object creation of type Complex
1204+
# 45| -2: [TypeMention] Complex
1205+
# 45| -1: [ObjectInitializer] { ..., ... }
1206+
# 45| 0: [MemberInitializer] ... = ...
1207+
# 45| 0: [PropertyCall] access to property Real
1208+
# 45| 1: [SubExpr] ... - ...
1209+
# 45| 0: [PropertyCall] access to property Real
1210+
# 45| -1: [ParameterAccess] access to parameter left
1211+
# 45| 1: [PropertyCall] access to property Real
1212+
# 45| -1: [ParameterAccess] access to parameter right
1213+
# 45| 1: [MemberInitializer] ... = ...
1214+
# 45| 0: [PropertyCall] access to property Imaginary
1215+
# 45| 1: [SubExpr] ... - ...
1216+
# 45| 0: [PropertyCall] access to property Imaginary
1217+
# 45| -1: [ParameterAccess] access to parameter left
1218+
# 45| 1: [PropertyCall] access to property Imaginary
1219+
# 45| -1: [ParameterAccess] access to parameter right
1220+
# 47| 12: [ExplicitConversionOperator] explicit conversion
1221+
# 47| -1: [TypeMention] int
1222+
#-----| 2: (Parameters)
1223+
# 47| 0: [Parameter] n
1224+
# 47| -1: [TypeMention] Complex
1225+
# 47| 4: [CastExpr] (...) ...
1226+
# 47| 0: [TypeAccess] access to type Int32
1227+
# 47| 0: [TypeMention] int
1228+
# 47| 1: [PropertyCall] access to property Real
1229+
# 47| -1: [ParameterAccess] access to parameter n
1230+
# 49| 13: [ExplicitConversionOperator] explicit conversion
1231+
# 49| -1: [TypeMention] short
1232+
#-----| 2: (Parameters)
1233+
# 49| 0: [Parameter] n
1234+
# 49| -1: [TypeMention] Complex
1235+
# 49| 4: [CastExpr] (...) ...
1236+
# 49| 0: [TypeAccess] access to type Int16
1237+
# 49| 0: [TypeMention] short
1238+
# 49| 1: [PropertyCall] access to property Real
1239+
# 49| -1: [ParameterAccess] access to parameter n
1240+
# 51| 14: [Method] Inc
1241+
# 51| -1: [TypeMention] Complex
1242+
# 51| -1: [TypeMention] INumber<Complex>
1243+
# 51| 1: [TypeMention] Complex
1244+
#-----| 2: (Parameters)
1245+
# 51| 0: [Parameter] other
1246+
# 51| -1: [TypeMention] Complex
1247+
# 52| 4: [ObjectCreation] object creation of type Complex
1248+
# 52| -2: [TypeMention] Complex
1249+
# 52| -1: [ObjectInitializer] { ..., ... }
1250+
# 52| 0: [MemberInitializer] ... = ...
1251+
# 52| 0: [PropertyCall] access to property Real
1252+
# 52| 1: [AddExpr] ... + ...
1253+
# 52| 0: [PropertyCall] access to property Real
1254+
# 52| -1: [ParameterAccess] access to parameter other
1255+
# 52| 1: [DoubleLiteral] 1
1256+
# 52| 1: [MemberInitializer] ... = ...
1257+
# 52| 0: [PropertyCall] access to property Imaginary
1258+
# 52| 1: [PropertyCall] access to property Imaginary
1259+
# 52| -1: [ParameterAccess] access to parameter other
1260+
# 54| 15: [Method] Dec
1261+
# 54| -1: [TypeMention] Complex
1262+
# 54| -1: [TypeMention] INumber<Complex>
1263+
# 54| 1: [TypeMention] Complex
1264+
#-----| 2: (Parameters)
1265+
# 54| 0: [Parameter] other
1266+
# 54| -1: [TypeMention] Complex
1267+
# 55| 4: [ObjectCreation] object creation of type Complex
1268+
# 55| -2: [TypeMention] Complex
1269+
# 55| -1: [ObjectInitializer] { ..., ... }
1270+
# 55| 0: [MemberInitializer] ... = ...
1271+
# 55| 0: [PropertyCall] access to property Real
1272+
# 55| 1: [SubExpr] ... - ...
1273+
# 55| 0: [PropertyCall] access to property Real
1274+
# 55| -1: [ParameterAccess] access to parameter other
1275+
# 55| 1: [DoubleLiteral] 1
1276+
# 55| 1: [MemberInitializer] ... = ...
1277+
# 55| 0: [PropertyCall] access to property Imaginary
1278+
# 55| 1: [PropertyCall] access to property Imaginary
1279+
# 55| -1: [ParameterAccess] access to parameter other
1280+
# 57| 16: [Method] Add
1281+
# 57| -1: [TypeMention] Complex
1282+
#-----| 2: (Parameters)
1283+
# 57| 0: [Parameter] left
1284+
# 57| -1: [TypeMention] Complex
1285+
# 57| 1: [Parameter] right
1286+
# 57| -1: [TypeMention] Complex
1287+
# 58| 4: [ObjectCreation] object creation of type Complex
1288+
# 58| -2: [TypeMention] Complex
1289+
# 58| -1: [ObjectInitializer] { ..., ... }
1290+
# 58| 0: [MemberInitializer] ... = ...
1291+
# 58| 0: [PropertyCall] access to property Real
1292+
# 58| 1: [AddExpr] ... + ...
1293+
# 58| 0: [PropertyCall] access to property Real
1294+
# 58| -1: [ParameterAccess] access to parameter left
1295+
# 58| 1: [PropertyCall] access to property Real
1296+
# 58| -1: [ParameterAccess] access to parameter right
1297+
# 58| 1: [MemberInitializer] ... = ...
1298+
# 58| 0: [PropertyCall] access to property Imaginary
1299+
# 58| 1: [AddExpr] ... + ...
1300+
# 58| 0: [PropertyCall] access to property Imaginary
1301+
# 58| -1: [ParameterAccess] access to parameter left
1302+
# 58| 1: [PropertyCall] access to property Imaginary
1303+
# 58| -1: [ParameterAccess] access to parameter right
1304+
# 60| 17: [Method] Subtract
1305+
# 60| -1: [TypeMention] Complex
1306+
#-----| 2: (Parameters)
1307+
# 60| 0: [Parameter] left
1308+
# 60| -1: [TypeMention] Complex
1309+
# 60| 1: [Parameter] right
1310+
# 60| -1: [TypeMention] Complex
1311+
# 61| 4: [ObjectCreation] object creation of type Complex
1312+
# 61| -2: [TypeMention] Complex
1313+
# 61| -1: [ObjectInitializer] { ..., ... }
1314+
# 61| 0: [MemberInitializer] ... = ...
1315+
# 61| 0: [PropertyCall] access to property Real
1316+
# 61| 1: [SubExpr] ... - ...
1317+
# 61| 0: [PropertyCall] access to property Real
1318+
# 61| -1: [ParameterAccess] access to parameter left
1319+
# 61| 1: [PropertyCall] access to property Real
1320+
# 61| -1: [ParameterAccess] access to parameter right
1321+
# 61| 1: [MemberInitializer] ... = ...
1322+
# 61| 0: [PropertyCall] access to property Imaginary
1323+
# 61| 1: [SubExpr] ... - ...
1324+
# 61| 0: [PropertyCall] access to property Imaginary
1325+
# 61| -1: [ParameterAccess] access to parameter left
1326+
# 61| 1: [PropertyCall] access to property Imaginary
1327+
# 61| -1: [ParameterAccess] access to parameter right
11841328
Strings.cs:
11851329
# 3| [Class] MyTestClass
11861330
# 5| 5: [Method] M1

0 commit comments

Comments
 (0)