mirror of
https://github.com/github/codeql.git
synced 2025-12-20 18:56:32 +01:00
Test generator fixes
- Revert previous change to constructor return values; as constructors are supposed to be modeled using Argument[-1] rather than ReturnValue - Fix generation of ambiguous calls when one of the conflicting methods is overridden
This commit is contained in:
@@ -228,7 +228,7 @@ class TestCase extends TTestCase {
|
||||
*/
|
||||
Type getOutputType() {
|
||||
if baseOutput = SummaryComponentStack::return()
|
||||
then result = getReturnType(callable)
|
||||
then result = callable.getReturnType()
|
||||
else
|
||||
exists(int i |
|
||||
baseOutput = SummaryComponentStack::argument(i) and
|
||||
|
||||
@@ -16,11 +16,6 @@ Type getRootSourceDeclaration(Type t) {
|
||||
else result = t
|
||||
}
|
||||
|
||||
/** Gets the return type of the callable c, or the constructed tpe if it's a constructor */
|
||||
Type getReturnType(Callable c) {
|
||||
if c instanceof Constructor then result = c.getDeclaringType() else result = c.getReturnType()
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if type `t` does not clash with another type we want to import that has the same base name.
|
||||
*/
|
||||
@@ -69,11 +64,12 @@ string getZero(PrimitiveType t) {
|
||||
* Holds if `c` may require disambiguation from an overload with the same argument count.
|
||||
*/
|
||||
predicate mayBeAmbiguous(Callable c) {
|
||||
exists(Callable other, string package, string type, string name |
|
||||
c.hasQualifiedName(package, type, name) and
|
||||
exists(Callable other, Callable override, string package, string type, string name |
|
||||
override = [c, c.(Method).getASourceOverriddenMethod*()] and
|
||||
override.hasQualifiedName(package, type, name) and
|
||||
other.hasQualifiedName(package, type, name) and
|
||||
other.getNumberOfParameters() = c.getNumberOfParameters() and
|
||||
other != c
|
||||
other.getNumberOfParameters() = override.getNumberOfParameters() and
|
||||
other != override
|
||||
)
|
||||
or
|
||||
c.isVarargs()
|
||||
|
||||
Reference in New Issue
Block a user