### Question:
Scope { public ArrayInfo declareArray(String name, PrimitiveType type) { return declareArray(getFreeArray(), name, type); } Scope(Scope parent); Local declareLocalVariable(String name, Type type); Local getLocalVariable(String name); ArrayInfo declareArray(String name, PrimitiveType type); ArrayInfo declareArray(int index, String name, PrimitiveType type); ArrayInfo getArray(String name); Scope createChild();  }### Answer:
@Test void testDeclareArray() { var scope = new Scope(null); scope.declareArray("first", PrimitiveType.INT); scope.declareArray("second", PrimitiveType.INT); assertEquals(2, scope.getArrayCount()); assertNotNull(scope.getArray("first")); assertNotNull(scope.getArray("second")); var childScope = scope.createChild(); for (var index = 0; index < 3; index++) { childScope.declareArray("array" + index, PrimitiveType.INT); } assertThrows(IllegalStateException.class, () -> childScope.declareArray("invalid", PrimitiveType.INT)); }