mirror of
https://github.com/github/codeql.git
synced 2026-01-30 14:52:57 +01:00
Merge pull request #614 from owen-mc/always-extract-empty-interface-type
Always extract empty interface type
This commit is contained in:
@@ -352,6 +352,9 @@ func extractUniverseScope() {
|
||||
lbl := tw.Labeler.ScopeID(types.Universe, nil)
|
||||
dbscheme.ScopesTable.Emit(tw, lbl, dbscheme.UniverseScopeType.Index())
|
||||
extractObjects(tw, types.Universe, lbl)
|
||||
|
||||
// Always extract an empty interface type
|
||||
extractType(tw, types.NewInterfaceType([]*types.Func{}, []types.Type{}))
|
||||
}
|
||||
|
||||
// extractObjects extracts all objects declared in the given scope
|
||||
|
||||
1
ql/test/extractor-tests/empty-interface/tst.expected
Normal file
1
ql/test/extractor-tests/empty-interface/tst.expected
Normal file
@@ -0,0 +1 @@
|
||||
| success |
|
||||
9
ql/test/extractor-tests/empty-interface/tst.go
Normal file
9
ql/test/extractor-tests/empty-interface/tst.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
// This file tests that the extractor does not crash on files that do not
|
||||
// end in a newline, so it is important not to autoformat this file.
|
||||
|
||||
// autoformat-ignore
|
||||
|
||||
func main() {
|
||||
}
|
||||
4
ql/test/extractor-tests/empty-interface/tst.ql
Normal file
4
ql/test/extractor-tests/empty-interface/tst.ql
Normal file
@@ -0,0 +1,4 @@
|
||||
import go
|
||||
|
||||
where exists(InterfaceType empty | not empty.hasMethod(_, _))
|
||||
select "success"
|
||||
Reference in New Issue
Block a user