Skip to content

Commit 3552936

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

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

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/Types/Aliases.ql

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ string getQualifiedNameIfExists(Type t) {
44
if exists(t.getQualifiedName()) then result = t.getQualifiedName() else result = t.getName()
55
}
66

7+
predicate foo(Type t, string s) { not exists(t.getQualifiedName()) and s = t.pp() }
8+
79
from AliasType at
810
where at.hasLocationInfo(_, _, _, _, _)
911
select getQualifiedNameIfExists(at), getQualifiedNameIfExists(at.getRhs()),

0 commit comments

Comments
 (0)