зеркало из https://github.com/github/codeql.git
Add test for multiple anonymous type parameters
This commit is contained in:
Родитель
90f7b30997
Коммит
9aafcbc1e3
|
@ -1,3 +1,25 @@
|
|||
numberOfTypeParameters
|
||||
| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 1 |
|
||||
| genericFunctions.go:9:6:9:32 | GenericFunctionOneTypeParam | 1 |
|
||||
| genericFunctions.go:15:6:15:33 | GenericFunctionTwoTypeParams | 2 |
|
||||
| genericFunctions.go:81:6:81:19 | GenericStruct1 | 1 |
|
||||
| genericFunctions.go:84:6:84:19 | GenericStruct2 | 2 |
|
||||
| genericFunctions.go:87:30:87:31 | f1 | 1 |
|
||||
| genericFunctions.go:92:31:92:32 | g1 | 1 |
|
||||
| genericFunctions.go:95:35:95:36 | f2 | 2 |
|
||||
| genericFunctions.go:98:36:98:37 | g2 | 2 |
|
||||
| genericFunctions.go:111:6:111:12 | Element | 1 |
|
||||
| genericFunctions.go:115:6:115:9 | List | 1 |
|
||||
| genericFunctions.go:120:19:120:23 | MyLen | 1 |
|
||||
| genericFunctions.go:124:6:124:19 | NodeConstraint | 1 |
|
||||
| genericFunctions.go:128:6:128:19 | EdgeConstraint | 1 |
|
||||
| genericFunctions.go:132:6:132:10 | Graph | 2 |
|
||||
| genericFunctions.go:134:6:134:8 | New | 2 |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | 2 |
|
||||
| genericFunctions.go:150:6:150:36 | multipleAnonymousTypeParamsFunc | 1 |
|
||||
| genericFunctions.go:152:6:152:36 | multipleAnonymousTypeParamsType | 1 |
|
||||
| genericFunctions.go:154:51:154:51 | f | 1 |
|
||||
#select
|
||||
| cmp.Compare | 0 | T | Ordered |
|
||||
| cmp.Less | 0 | T | Ordered |
|
||||
| cmp.Or | 0 | T | comparable |
|
||||
|
@ -26,30 +48,56 @@
|
|||
| codeql-go-tests/function.New | 0 | Node | NodeConstraint |
|
||||
| codeql-go-tests/function.New | 1 | Edge | EdgeConstraint |
|
||||
| codeql-go-tests/function.NodeConstraint | 0 | Edge | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 0 | _ | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 1 | _ | interface { string } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsFunc | 2 | _ | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType | 0 | _ | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType | 1 | _ | interface { string } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType | 2 | _ | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 0 | _ | interface { } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 1 | _ | interface { string } |
|
||||
| codeql-go-tests/function.multipleAnonymousTypeParamsType.f | 2 | _ | interface { } |
|
||||
| github.com/anotherpkg.GenericFunctionInAnotherPackage | 0 | T | interface { } |
|
||||
| internal/abi.Escape | 0 | T | interface { } |
|
||||
| internal/bytealg.HashStr | 0 | T | interface { string \| []uint8 } |
|
||||
| internal/bytealg.HashStrRev | 0 | T | interface { string \| []uint8 } |
|
||||
| internal/bytealg.IndexRabinKarp | 0 | T | interface { string \| []uint8 } |
|
||||
| internal/bytealg.LastIndexRabinKarp | 0 | T | interface { string \| []uint8 } |
|
||||
| internal/runtime/atomic.Pointer.CompareAndSwap | 0 | T | interface { } |
|
||||
| internal/runtime/atomic.Pointer.CompareAndSwapNoWB | 0 | T | interface { } |
|
||||
| internal/runtime/atomic.Pointer.Load | 0 | T | interface { } |
|
||||
| internal/runtime/atomic.Pointer.Store | 0 | T | interface { } |
|
||||
| internal/runtime/atomic.Pointer.StoreNoWB | 0 | T | interface { } |
|
||||
| iter.Pull | 0 | V | interface { } |
|
||||
| iter.Pull2 | 0 | K | interface { } |
|
||||
| iter.Pull2 | 1 | V | interface { } |
|
||||
| iter.Seq | 0 | V | interface { } |
|
||||
| iter.Seq2 | 0 | K | interface { } |
|
||||
| iter.Seq2 | 1 | V | interface { } |
|
||||
| reflect.rangeNum | 1 | N | interface { int64 \| uint64 } |
|
||||
| runtime.fandbits | 0 | F | floaty |
|
||||
| runtime.fmax | 0 | F | floaty |
|
||||
| runtime.fmin | 0 | F | floaty |
|
||||
| runtime.forbits | 0 | F | floaty |
|
||||
| runtime.noEscapePtr | 0 | T | interface { } |
|
||||
| runtime/internal/atomic.Pointer.CompareAndSwap | 0 | T | interface { } |
|
||||
| runtime/internal/atomic.Pointer.CompareAndSwapNoWB | 0 | T | interface { } |
|
||||
| runtime/internal/atomic.Pointer.Load | 0 | T | interface { } |
|
||||
| runtime/internal/atomic.Pointer.Store | 0 | T | interface { } |
|
||||
| runtime/internal/atomic.Pointer.StoreNoWB | 0 | T | interface { } |
|
||||
| slices.All | 0 | Slice | interface { ~[]E } |
|
||||
| slices.All | 1 | E | interface { } |
|
||||
| slices.AppendSeq | 0 | Slice | interface { ~[]E } |
|
||||
| slices.AppendSeq | 1 | E | interface { } |
|
||||
| slices.Backward | 0 | Slice | interface { ~[]E } |
|
||||
| slices.Backward | 1 | E | interface { } |
|
||||
| slices.BinarySearch | 0 | S | interface { ~[]E } |
|
||||
| slices.BinarySearch | 1 | E | Ordered |
|
||||
| slices.BinarySearchFunc | 0 | S | interface { ~[]E } |
|
||||
| slices.BinarySearchFunc | 1 | E | interface { } |
|
||||
| slices.BinarySearchFunc | 2 | T | interface { } |
|
||||
| slices.Chunk | 0 | Slice | interface { ~[]E } |
|
||||
| slices.Chunk | 1 | E | interface { } |
|
||||
| slices.Clip | 0 | S | interface { ~[]E } |
|
||||
| slices.Clip | 1 | E | interface { } |
|
||||
| slices.Clone | 0 | S | interface { ~[]E } |
|
||||
| slices.Clone | 1 | E | interface { } |
|
||||
| slices.Collect | 0 | E | interface { } |
|
||||
| slices.Compact | 0 | S | interface { ~[]E } |
|
||||
| slices.Compact | 1 | E | comparable |
|
||||
| slices.CompactFunc | 0 | S | interface { ~[]E } |
|
||||
|
@ -96,6 +144,8 @@
|
|||
| slices.Min | 1 | E | Ordered |
|
||||
| slices.MinFunc | 0 | S | interface { ~[]E } |
|
||||
| slices.MinFunc | 1 | E | interface { } |
|
||||
| slices.Repeat | 0 | S | interface { ~[]E } |
|
||||
| slices.Repeat | 1 | E | interface { } |
|
||||
| slices.Replace | 0 | S | interface { ~[]E } |
|
||||
| slices.Replace | 1 | E | interface { } |
|
||||
| slices.Reverse | 0 | S | interface { ~[]E } |
|
||||
|
@ -106,6 +156,11 @@
|
|||
| slices.SortFunc | 1 | E | interface { } |
|
||||
| slices.SortStableFunc | 0 | S | interface { ~[]E } |
|
||||
| slices.SortStableFunc | 1 | E | interface { } |
|
||||
| slices.Sorted | 0 | E | Ordered |
|
||||
| slices.SortedFunc | 0 | E | interface { } |
|
||||
| slices.SortedStableFunc | 0 | E | interface { } |
|
||||
| slices.Values | 0 | Slice | interface { ~[]E } |
|
||||
| slices.Values | 1 | E | interface { } |
|
||||
| slices.breakPatternsCmpFunc | 0 | E | interface { } |
|
||||
| slices.breakPatternsOrdered | 0 | E | Ordered |
|
||||
| slices.choosePivotCmpFunc | 0 | E | interface { } |
|
||||
|
@ -141,11 +196,12 @@
|
|||
| slices.stableCmpFunc | 0 | E | interface { } |
|
||||
| slices.stableOrdered | 0 | E | Ordered |
|
||||
| slices.startIdx | 0 | E | interface { } |
|
||||
| slices.swap | 0 | E | interface { } |
|
||||
| slices.swapRangeCmpFunc | 0 | E | interface { } |
|
||||
| slices.swapRangeOrdered | 0 | E | Ordered |
|
||||
| slices.symMergeCmpFunc | 0 | E | interface { } |
|
||||
| slices.symMergeOrdered | 0 | E | Ordered |
|
||||
| strconv.bsearch | 0 | S | interface { ~[]E } |
|
||||
| strconv.bsearch | 1 | E | interface { ~uint16 \| ~uint32 } |
|
||||
| sync.OnceValue | 0 | T | interface { } |
|
||||
| sync.OnceValues | 0 | T1 | interface { } |
|
||||
| sync.OnceValues | 1 | T2 | interface { } |
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
import go
|
||||
|
||||
query predicate numberOfTypeParameters(TypeParamParentEntity parent, int n) {
|
||||
exists(string file | file != "" | parent.hasLocationInfo(file, _, _, _, _)) and
|
||||
n = strictcount(TypeParamType tpt | tpt.getParent() = parent)
|
||||
}
|
||||
|
||||
from TypeParamType tpt, TypeParamParentEntity ty
|
||||
where ty = tpt.getParent()
|
||||
select ty.getQualifiedName(), tpt.getIndex(), tpt.getParamName(), tpt.getConstraint().pp()
|
||||
|
|
|
@ -146,3 +146,9 @@ func callFunctionsInAnotherPackage() {
|
|||
_ = anotherpkg.GenericFunctionInAnotherPackage[string]("world")
|
||||
_ = anotherpkg.GenericFunctionInAnotherPackage("world")
|
||||
}
|
||||
|
||||
func multipleAnonymousTypeParamsFunc[_ any, _ string, _ any]() {}
|
||||
|
||||
type multipleAnonymousTypeParamsType[_ any, _ string, _ any] struct{}
|
||||
|
||||
func (x multipleAnonymousTypeParamsType[_, _, _]) f() {}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
| genericFunctions.go:138:29:138:40 | ShortestPath | 0 | genericFunctions.go:138:42:138:45 | from |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | 1 | genericFunctions.go:138:48:138:49 | to |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | -1 | genericFunctions.go:138:7:138:7 | g |
|
||||
| genericFunctions.go:154:51:154:51 | f | -1 | genericFunctions.go:154:7:154:7 | x |
|
||||
| main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x |
|
||||
| main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x |
|
||||
| main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y |
|
||||
|
|
|
@ -13,3 +13,9 @@
|
|||
| genericFunctions.go:132:6:132:73 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:132:39:132:63 | type parameter declaration | 0 | genericFunctions.go:132:39:132:42 | Edge | genericFunctions.go:132:44:132:63 | generic type instantiation expression | EdgeConstraint |
|
||||
| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 0 | genericFunctions.go:134:10:134:34 | type parameter declaration | 0 | genericFunctions.go:134:10:134:13 | Node | genericFunctions.go:134:15:134:34 | generic type instantiation expression | NodeConstraint |
|
||||
| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 1 | genericFunctions.go:134:37:134:61 | type parameter declaration | 0 | genericFunctions.go:134:37:134:40 | Edge | genericFunctions.go:134:42:134:61 | generic type instantiation expression | EdgeConstraint |
|
||||
| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 0 | genericFunctions.go:150:38:150:42 | type parameter declaration | 0 | genericFunctions.go:150:38:150:38 | _ | genericFunctions.go:150:40:150:42 | any | interface { } |
|
||||
| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 1 | genericFunctions.go:150:45:150:52 | type parameter declaration | 0 | genericFunctions.go:150:45:150:45 | _ | genericFunctions.go:150:47:150:52 | string | interface { string } |
|
||||
| genericFunctions.go:150:1:150:65 | function declaration | FuncDecl | 2 | genericFunctions.go:150:55:150:59 | type parameter declaration | 0 | genericFunctions.go:150:55:150:55 | _ | genericFunctions.go:150:57:150:59 | any | interface { } |
|
||||
| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:152:38:152:42 | type parameter declaration | 0 | genericFunctions.go:152:38:152:38 | _ | genericFunctions.go:152:40:152:42 | any | interface { } |
|
||||
| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:152:45:152:52 | type parameter declaration | 0 | genericFunctions.go:152:45:152:45 | _ | genericFunctions.go:152:47:152:52 | string | interface { string } |
|
||||
| genericFunctions.go:152:6:152:69 | type declaration specifier | TypeSpec | 2 | genericFunctions.go:152:55:152:59 | type parameter declaration | 0 | genericFunctions.go:152:55:152:55 | _ | genericFunctions.go:152:57:152:59 | any | interface { } |
|
||||
|
|
Загрузка…
Ссылка в новой задаче