Skip to content

Commit ab657b1

Browse files
committed
Fix syntax error in test
1 parent 6231211 commit ab657b1

File tree

4 files changed

+32
-26
lines changed

4 files changed

+32
-26
lines changed

Diff for: go/ql/test/library-tests/semmle/go/Function/GenericFunctionInstantiationExpr.expected

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
| genericFunctions.go:46:6:46:48 | generic function instantiation expression | genericFunctions.go:46:6:46:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:46:43:46:47 | int64 |
55
| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:47:35:47:40 | string |
66
| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:47:43:47:49 | float64 |
7-
| genericFunctions.go:143:6:143:41 | generic function instantiation expression | genericFunctions.go:143:6:143:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:143:35:143:40 | string |
8-
| genericFunctions.go:148:6:148:55 | generic function instantiation expression | genericFunctions.go:148:6:148:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:148:49:148:54 | string |
7+
| genericFunctions.go:149:6:149:41 | generic function instantiation expression | genericFunctions.go:149:6:149:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:149:35:149:40 | string |
8+
| genericFunctions.go:154:6:154:55 | generic function instantiation expression | genericFunctions.go:154:6:154:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:154:49:154:54 | string |

Diff for: go/ql/test/library-tests/semmle/go/Function/genericFunctions.go

+10-4
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,18 @@ func generic_functions() {
7272
// Slice write
7373
sliceVar[0] = -1
7474

75-
// Access a map through two type aliases
76-
aliasedMap := T2{"key": []string{"value"}}
75+
// Access a map through two named types
76+
mapThroughNamedTypes := DefinedType2{"key": []string{"value"}}
7777
// Map read
78-
_ = aliasedMap["key"]
78+
_ = mapThroughNamedTypes["key"]
7979
// Map write
80-
aliasedMap["key"][0] = "new value"
80+
mapThroughNamedTypes["key"][0] = "new value"
81+
// Access a map through two type aliases and two named types
82+
mapThroughAliasedTypes := AliasType2{"key": []string{"value"}}
83+
// Map read
84+
_ = mapThroughAliasedTypes["key"]
85+
// Map write
86+
mapThroughAliasedTypes["key"][0] = "new value"
8187
}
8288

8389
type GenericStruct1[TP104 interface{}] struct {

Diff for: go/ql/test/library-tests/semmle/go/Function/getParameter.expected

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 0 | genericFunctions2.go:3:46:3:46 | t |
22
| genericFunctions.go:11:6:11:32 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:11:45:11:45 | t |
33
| genericFunctions.go:17:6:17:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:17:76:17:76 | m |
4-
| genericFunctions.go:89:32:89:33 | f1 | -1 | genericFunctions.go:89:7:89:7 | x |
5-
| genericFunctions.go:94:33:94:34 | g1 | -1 | genericFunctions.go:94:7:94:7 | x |
6-
| genericFunctions.go:97:39:97:40 | f2 | -1 | genericFunctions.go:97:7:97:7 | x |
7-
| genericFunctions.go:100:40:100:41 | g2 | -1 | genericFunctions.go:100:7:100:7 | x |
8-
| genericFunctions.go:122:23:122:27 | MyLen | -1 | genericFunctions.go:122:7:122:7 | l |
9-
| genericFunctions.go:136:6:136:8 | New | 0 | genericFunctions.go:136:68:136:72 | nodes |
10-
| genericFunctions.go:140:31:140:42 | ShortestPath | 0 | genericFunctions.go:140:44:140:47 | from |
11-
| genericFunctions.go:140:31:140:42 | ShortestPath | 1 | genericFunctions.go:140:50:140:51 | to |
12-
| genericFunctions.go:140:31:140:42 | ShortestPath | -1 | genericFunctions.go:140:7:140:7 | g |
4+
| genericFunctions.go:95:32:95:33 | f1 | -1 | genericFunctions.go:95:7:95:7 | x |
5+
| genericFunctions.go:100:33:100:34 | g1 | -1 | genericFunctions.go:100:7:100:7 | x |
6+
| genericFunctions.go:103:39:103:40 | f2 | -1 | genericFunctions.go:103:7:103:7 | x |
7+
| genericFunctions.go:106:40:106:41 | g2 | -1 | genericFunctions.go:106:7:106:7 | x |
8+
| genericFunctions.go:128:23:128:27 | MyLen | -1 | genericFunctions.go:128:7:128:7 | l |
9+
| genericFunctions.go:142:6:142:8 | New | 0 | genericFunctions.go:142:68:142:72 | nodes |
10+
| genericFunctions.go:146:31:146:42 | ShortestPath | 0 | genericFunctions.go:146:44:146:47 | from |
11+
| genericFunctions.go:146:31:146:42 | ShortestPath | 1 | genericFunctions.go:146:50:146:51 | to |
12+
| genericFunctions.go:146:31:146:42 | ShortestPath | -1 | genericFunctions.go:146:7:146:7 | g |
1313
| main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x |
1414
| main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x |
1515
| main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y |

Diff for: go/ql/test/library-tests/semmle/go/Function/getTypeParameter.expected

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
| genericFunctions.go:11:1:14:1 | function declaration | FuncDecl | 0 | genericFunctions.go:11:34:11:42 | type parameter declaration | 0 | genericFunctions.go:11:34:11:38 | TP101 | genericFunctions.go:11:40:11:42 | any | any |
33
| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 0 | genericFunctions.go:17:35:17:50 | type parameter declaration | 0 | genericFunctions.go:17:35:17:39 | TP102 | genericFunctions.go:17:41:17:50 | comparable | comparable |
44
| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 1 | genericFunctions.go:17:53:17:73 | type parameter declaration | 0 | genericFunctions.go:17:53:17:57 | TP103 | genericFunctions.go:17:59:17:73 | type set literal | interface { int64 \| float64 } |
5-
| genericFunctions.go:83:6:84:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:83:21:83:37 | type parameter declaration | 0 | genericFunctions.go:83:21:83:25 | TP104 | genericFunctions.go:83:27:83:37 | interface type | interface { } |
6-
| genericFunctions.go:86:6:87:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:86:21:86:36 | type parameter declaration | 0 | genericFunctions.go:86:21:86:25 | TP105 | genericFunctions.go:86:34:86:36 | any | any |
7-
| genericFunctions.go:86:6:87:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:86:21:86:36 | type parameter declaration | 1 | genericFunctions.go:86:28:86:32 | TP106 | genericFunctions.go:86:34:86:36 | any | any |
8-
| genericFunctions.go:113:6:115:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:113:14:113:22 | type parameter declaration | 0 | genericFunctions.go:113:14:113:18 | TP113 | genericFunctions.go:113:20:113:22 | any | any |
9-
| genericFunctions.go:117:6:119:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:117:11:117:19 | type parameter declaration | 0 | genericFunctions.go:117:11:117:15 | TP114 | genericFunctions.go:117:17:117:19 | any | any |
10-
| genericFunctions.go:126:6:128:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:126:21:126:29 | type parameter declaration | 0 | genericFunctions.go:126:21:126:25 | TP116 | genericFunctions.go:126:27:126:29 | any | any |
11-
| genericFunctions.go:130:6:132:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:130:21:130:29 | type parameter declaration | 0 | genericFunctions.go:130:21:130:25 | TP117 | genericFunctions.go:130:27:130:29 | any | any |
12-
| genericFunctions.go:134:6:134:77 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:134:12:134:38 | type parameter declaration | 0 | genericFunctions.go:134:12:134:16 | TP118 | genericFunctions.go:134:18:134:38 | generic type instantiation expression | NodeConstraint |
13-
| genericFunctions.go:134:6:134:77 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:134:41:134:67 | type parameter declaration | 0 | genericFunctions.go:134:41:134:45 | TP119 | genericFunctions.go:134:47:134:67 | generic type instantiation expression | EdgeConstraint |
14-
| genericFunctions.go:136:1:138:1 | function declaration | FuncDecl | 0 | genericFunctions.go:136:10:136:36 | type parameter declaration | 0 | genericFunctions.go:136:10:136:14 | TP120 | genericFunctions.go:136:16:136:36 | generic type instantiation expression | NodeConstraint |
15-
| genericFunctions.go:136:1:138:1 | function declaration | FuncDecl | 1 | genericFunctions.go:136:39:136:65 | type parameter declaration | 0 | genericFunctions.go:136:39:136:43 | TP121 | genericFunctions.go:136:45:136:65 | generic type instantiation expression | EdgeConstraint |
5+
| genericFunctions.go:89:6:90:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:89:21:89:37 | type parameter declaration | 0 | genericFunctions.go:89:21:89:25 | TP104 | genericFunctions.go:89:27:89:37 | interface type | interface { } |
6+
| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 0 | genericFunctions.go:92:21:92:25 | TP105 | genericFunctions.go:92:34:92:36 | any | any |
7+
| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 1 | genericFunctions.go:92:28:92:32 | TP106 | genericFunctions.go:92:34:92:36 | any | any |
8+
| genericFunctions.go:119:6:121:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:119:14:119:22 | type parameter declaration | 0 | genericFunctions.go:119:14:119:18 | TP113 | genericFunctions.go:119:20:119:22 | any | any |
9+
| genericFunctions.go:123:6:125:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:123:11:123:19 | type parameter declaration | 0 | genericFunctions.go:123:11:123:15 | TP114 | genericFunctions.go:123:17:123:19 | any | any |
10+
| genericFunctions.go:132:6:134:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:132:21:132:29 | type parameter declaration | 0 | genericFunctions.go:132:21:132:25 | TP116 | genericFunctions.go:132:27:132:29 | any | any |
11+
| genericFunctions.go:136:6:138:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:136:21:136:29 | type parameter declaration | 0 | genericFunctions.go:136:21:136:25 | TP117 | genericFunctions.go:136:27:136:29 | any | any |
12+
| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:140:12:140:38 | type parameter declaration | 0 | genericFunctions.go:140:12:140:16 | TP118 | genericFunctions.go:140:18:140:38 | generic type instantiation expression | NodeConstraint |
13+
| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:140:41:140:67 | type parameter declaration | 0 | genericFunctions.go:140:41:140:45 | TP119 | genericFunctions.go:140:47:140:67 | generic type instantiation expression | EdgeConstraint |
14+
| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 0 | genericFunctions.go:142:10:142:36 | type parameter declaration | 0 | genericFunctions.go:142:10:142:14 | TP120 | genericFunctions.go:142:16:142:36 | generic type instantiation expression | NodeConstraint |
15+
| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 1 | genericFunctions.go:142:39:142:65 | type parameter declaration | 0 | genericFunctions.go:142:39:142:43 | TP121 | genericFunctions.go:142:45:142:65 | generic type instantiation expression | EdgeConstraint |

0 commit comments

Comments
 (0)