Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb4e1d1

Browse filesBrowse files
committed
Go: Update test for aliases to print immediate RHS and underlying type
1 parent 0c0f748 commit eb4e1d1
Copy full SHA for eb4e1d1

File tree

5 files changed

+33
-38
lines changed
Filter options

5 files changed

+33
-38
lines changed
+14-37Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
1-
| DirEntry | file://:0:0:0:0 | DirEntry |
2-
| FileInfo | file://:0:0:0:0 | FileInfo |
3-
| FileMode | file://:0:0:0:0 | FileMode |
4-
| GenericSignatureAlias | generic.go:84:6:84:21 | GenericSignature |
5-
| Kind | file://:0:0:0:0 | Kind |
6-
| Kind | file://:0:0:0:0 | basic interface type |
7-
| PathError | file://:0:0:0:0 | PathError |
8-
| TypeAlias | generic.go:36:6:36:17 | GenericArray |
9-
| _type | file://:0:0:0:0 | Type |
10-
| aNameOff | file://:0:0:0:0 | NameOff |
11-
| aTextOff | file://:0:0:0:0 | TextOff |
12-
| aTypeOff | file://:0:0:0:0 | TypeOff |
13-
| any | file://:0:0:0:0 | Kind |
14-
| any | file://:0:0:0:0 | basic interface type |
15-
| arrayType | file://:0:0:0:0 | ArrayType |
16-
| arraytype | file://:0:0:0:0 | ArrayType |
17-
| chanType | file://:0:0:0:0 | ChanType |
18-
| chantype | file://:0:0:0:0 | ChanType |
19-
| funcType | file://:0:0:0:0 | FuncType |
20-
| functype | file://:0:0:0:0 | FuncType |
21-
| interfaceType | file://:0:0:0:0 | InterfaceType |
22-
| interfacetype | file://:0:0:0:0 | InterfaceType |
23-
| maptype | file://:0:0:0:0 | MapType |
24-
| name | file://:0:0:0:0 | Name |
25-
| nameOff | file://:0:0:0:0 | NameOff |
26-
| ptrType | file://:0:0:0:0 | PtrType |
27-
| ptrtype | file://:0:0:0:0 | PtrType |
28-
| sliceType | file://:0:0:0:0 | SliceType |
29-
| slicetype | file://:0:0:0:0 | SliceType |
30-
| structField | file://:0:0:0:0 | StructField |
31-
| structType | file://:0:0:0:0 | StructType |
32-
| structtype | file://:0:0:0:0 | StructType |
33-
| syscallErrorType | file://:0:0:0:0 | Errno |
34-
| textOff | file://:0:0:0:0 | TextOff |
35-
| typeOff | file://:0:0:0:0 | TypeOff |
36-
| uncommonType | file://:0:0:0:0 | UncommonType |
37-
| uncommontype | file://:0:0:0:0 | UncommonType |
1+
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias | string | string |
2+
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.SecondAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias | string |
3+
| internal/reflectlite.Kind | internal/abi.Kind | uint |
4+
| internal/reflectlite.nameOff | internal/abi.NameOff | int32 |
5+
| internal/reflectlite.textOff | internal/abi.TextOff | int32 |
6+
| internal/reflectlite.typeOff | internal/abi.TypeOff | int32 |
7+
| os.FileMode | io/fs.FileMode | uint32 |
8+
| os.syscallErrorType | syscall.Errno | uintptr |
9+
| reflect.aNameOff | internal/abi.NameOff | int32 |
10+
| reflect.aTextOff | internal/abi.TextOff | int32 |
11+
| reflect.aTypeOff | internal/abi.TypeOff | int32 |
12+
| runtime.nameOff | internal/abi.NameOff | int32 |
13+
| runtime.textOff | internal/abi.TextOff | int32 |
14+
| runtime.typeOff | internal/abi.TypeOff | int32 |
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
import go
22

3+
string getQualifiedNameIfExists(Type t) {
4+
if exists(t.getQualifiedName()) then result = t.getQualifiedName() else result = t.getName()
5+
}
6+
37
from AliasType at
4-
select at.getName(), at.getRhs()
8+
where at.hasLocationInfo(_, _, _, _, _)
9+
select getQualifiedNameIfExists(at), getQualifiedNameIfExists(at.getRhs()),
10+
getQualifiedNameIfExists(at.getUnderlyingType())

‎go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected

Copy file name to clipboardExpand all lines: go/ql/test/library-tests/semmle/go/Types/QualifiedNames.expected
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
| aliases.go:3:6:3:15 | FirstAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias |
2+
| aliases.go:4:6:4:16 | SecondAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.SecondAlias |
13
| cyclic.go:3:6:3:6 | s | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.s |
24
| cyclic.go:7:6:7:6 | t | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.t |
35
| cyclic.go:12:6:12:6 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.u |
@@ -29,7 +31,9 @@
2931
| generic.go:47:6:47:16 | MyInterface | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.MyInterface |
3032
| generic.go:67:6:67:22 | HasBlankTypeParam | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParam |
3133
| generic.go:68:6:68:23 | HasBlankTypeParams | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParams |
34+
| generic.go:82:6:82:14 | TypeAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.TypeAlias |
3235
| generic.go:84:6:84:21 | GenericSignature | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignature |
36+
| generic.go:85:6:85:26 | GenericSignatureAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignatureAlias |
3337
| interface.go:3:6:3:7 | i0 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i0 |
3438
| interface.go:5:6:5:7 | i1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i1 |
3539
| interface.go:9:6:9:7 | i2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i2 |

‎go/ql/test/library-tests/semmle/go/Types/Types.expected

Copy file name to clipboardExpand all lines: go/ql/test/library-tests/semmle/go/Types/Types.expected
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
| aliases.go:3:6:3:15 | FirstAlias | FirstAlias |
2+
| aliases.go:4:6:4:16 | SecondAlias | SecondAlias |
13
| cyclic.go:3:6:3:6 | s | s |
24
| cyclic.go:7:6:7:6 | t | t |
35
| cyclic.go:12:6:12:6 | u | u |
@@ -29,7 +31,9 @@
2931
| generic.go:47:6:47:16 | MyInterface | MyInterface |
3032
| generic.go:67:6:67:22 | HasBlankTypeParam | HasBlankTypeParam |
3133
| generic.go:68:6:68:23 | HasBlankTypeParams | HasBlankTypeParams |
34+
| generic.go:82:6:82:14 | TypeAlias | TypeAlias |
3235
| generic.go:84:6:84:21 | GenericSignature | GenericSignature |
36+
| generic.go:85:6:85:26 | GenericSignatureAlias | GenericSignatureAlias |
3337
| interface.go:3:6:3:7 | i0 | i0 |
3438
| interface.go:5:6:5:7 | i1 | i1 |
3539
| interface.go:9:6:9:7 | i2 | i2 |
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package main
2+
3+
type FirstAlias = string
4+
type SecondAlias = FirstAlias

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.