Files
codeql/csharp/ql/test/library-tests/expressions/ArrayCreation5.ql
2026-04-01 12:50:37 +02:00

22 lines
641 B
Plaintext

/**
* @name Test for array creations
*/
import csharp
from Assignment a, ArrayCreation e, int i
where
a.getLeftOperand().(VariableAccess).getTarget().hasName("is5") and
e = a.getRightOperand() and
e.isImplicitlyTyped() and
e.isImplicitlySized() and
e.getArrayType().getDimension() = 1 and
e.getArrayType().getRank() = 1 and
e.getArrayType().getElementType() instanceof IntType and
e.getInitializer().getNumberOfElements() = 4 and
// Workaround for `e.getInitializer().getElement(2).getValue() = "100"`
// until CORE-182 has been resolved
e.getInitializer().getElement(i + 1).getValue() = "100" and
i = 1
select e