Autoformat

This commit is contained in:
Chris Smowton
2024-09-03 21:29:56 +01:00
parent bf2fb2f6e2
commit 6ed0a37efd
3 changed files with 27 additions and 23 deletions

View File

@@ -1,13 +1,13 @@
callTargets
| test.go:38:2:38:24 | call to ImplementMe | test.go:12:1:12:72 | function declaration | ImplementMe |
| test.go:38:2:38:24 | call to ImplementMe | test.go:17:1:17:67 | function declaration | ImplementMe |
| test.go:38:2:38:24 | call to ImplementMe | test.go:23:1:23:54 | function declaration | ImplementMe |
| test.go:38:2:38:24 | call to ImplementMe | test.go:29:1:29:61 | function declaration | ImplementMe |
| test.go:38:2:38:24 | call to ImplementMe | test.go:35:1:35:74 | function declaration | ImplementMe |
| test.go:41:2:41:24 | call to ImplementMe | test.go:12:1:12:69 | function declaration | ImplementMe |
| test.go:41:2:41:24 | call to ImplementMe | test.go:17:1:17:64 | function declaration | ImplementMe |
| test.go:41:2:41:24 | call to ImplementMe | test.go:24:1:24:53 | function declaration | ImplementMe |
| test.go:41:2:41:24 | call to ImplementMe | test.go:31:1:31:59 | function declaration | ImplementMe |
| test.go:41:2:41:24 | call to ImplementMe | test.go:38:1:38:71 | function declaration | ImplementMe |
#select
| file://:0:0:0:0 | basic interface type | file://:0:0:0:0 | basic interface type |
| file://:0:0:0:0 | basic interface type | test.go:10:6:10:10 | Impl1 |
| file://:0:0:0:0 | basic interface type | test.go:15:6:15:10 | Impl2 |
| file://:0:0:0:0 | basic interface type | test.go:20:6:20:10 | Impl3 |
| file://:0:0:0:0 | basic interface type | test.go:26:6:26:10 | Impl4 |
| file://:0:0:0:0 | basic interface type | test.go:32:6:32:10 | Impl5 |
| file://:0:0:0:0 | basic interface type | test.go:27:6:27:10 | Impl4 |
| file://:0:0:0:0 | basic interface type | test.go:34:6:34:10 | Impl5 |

View File

@@ -3,36 +3,39 @@ package intfs
type IntAlias = int
type Target = interface {
ImplementMe(callable func (struct { x IntAlias }))
ImplementMe(callable func(struct{ x IntAlias }))
}
// Simple direct implementation
type Impl1 struct {}
type Impl1 struct{}
func (recv Impl1) ImplementMe(callable func (struct { x IntAlias })) { }
func (recv Impl1) ImplementMe(callable func(struct{ x IntAlias })) {}
// Implementation via unalising
type Impl2 struct {}
type Impl2 struct{}
func (recv Impl2) ImplementMe(callable func (struct { x int })) { }
func (recv Impl2) ImplementMe(callable func(struct{ x int })) {}
// Implementation via top-level aliasing
type Impl3 struct {}
type Impl3 struct{}
type Impl3Alias = func (struct { x IntAlias })
func (recv Impl3) ImplementMe(callable Impl3Alias) { }
type Impl3Alias = func(struct{ x IntAlias })
func (recv Impl3) ImplementMe(callable Impl3Alias) {}
// Implementation via aliasing the struct
type Impl4 struct {}
type Impl4 struct{}
type Impl4Alias = struct { x IntAlias }
func (recv Impl4) ImplementMe(callable func (Impl4Alias)) { }
type Impl4Alias = struct{ x IntAlias }
func (recv Impl4) ImplementMe(callable func(Impl4Alias)) {}
// Implementation via aliasing the struct member
type Impl5 struct {}
type Impl5 struct{}
type Impl5Alias = IntAlias
func (recv Impl5) ImplementMe(callable func (struct { x Impl5Alias })) { }
type Impl5Alias = IntAlias
func (recv Impl5) ImplementMe(callable func(struct{ x Impl5Alias })) {}
func Caller(target Target) {
target.ImplementMe(nil)

View File

@@ -5,6 +5,7 @@ query predicate callTargets(DataFlow::CallNode cn, FuncDef target, string target
}
from InterfaceType i, Type impl
where i.hasMethod("ImplementMe", _)
and impl.implements(i)
where
i.hasMethod("ImplementMe", _) and
impl.implements(i)
select i, impl