mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Type-variable-in-scope consistency query: account for all enclosing elements that declare type parameters.
This commit is contained in:
@@ -30,14 +30,22 @@ Type getATypeUsedInClass(RefType type) {
|
||||
result = getAMentionedType(getATypeUsedInClass(type))
|
||||
}
|
||||
|
||||
Element getEnclosingElementStar(RefType e) {
|
||||
result = e
|
||||
or
|
||||
result.contains(e)
|
||||
}
|
||||
|
||||
TypeVariable getATypeVariableInScope(RefType type) {
|
||||
result = type.getACallable().(GenericCallable).getATypeParameter()
|
||||
or
|
||||
result = type.(GenericType).getATypeParameter()
|
||||
or
|
||||
result = getAMentionedType(type.(InstantiatedType).getATypeArgument())
|
||||
or
|
||||
result = getATypeVariableInScope(type.getEnclosingType())
|
||||
exists(Element e | e = getEnclosingElementStar(type) |
|
||||
result = e.(RefType).getACallable().(GenericCallable).getATypeParameter()
|
||||
or
|
||||
result = e.(GenericType).getATypeParameter()
|
||||
or
|
||||
result = e.(GenericCallable).getATypeParameter()
|
||||
or
|
||||
result = getAMentionedType(e.(InstantiatedType).getATypeArgument())
|
||||
)
|
||||
}
|
||||
|
||||
from ClassOrInterface typeUser, TypeVariable outOfScope
|
||||
|
||||
Reference in New Issue
Block a user