Skip to content

Conversation

@jaredlll08
Copy link
Member

This is the same PR as #51, which was reverted due to failing tests, with the only change being:

	public Type getASMType() {
+		if(CompilerUtils.isPrimitive(elementType)) {
+			return context.getType(elementType);
+		}
		return Type.getType("[" + context.getDescriptor(elementType));
	}

in ArrayHelperType.java, all the tests pass.

Copy link
Member

@kindlich kindlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick tests shows its working.

logger.assertPrintOutput(0, "A0A");
logger.assertPrintOutput(1, "B1B");
logger.assertPrintOutput(2, "C2C");
}
Copy link
Member

@kindlich kindlich Nov 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could add tests for the other means of creating arrays (both single, and multi-dimensional):

  • Literal: var x = [1, 2, 3]
  • Constructor with default value
    • 1D: var x = new int[](size, defaultValue); println(x[0]);
    • 2D: var x = new int[,](sizeA, sizeB, defaultValue); println(x[0,0]);
  • Constructor with callback function var x = new int[](size, (index as usize) => {return 10 as int;}); println(x[0]);
  • Constructor with projection function var x = [1, 2, 3] as int[]; var y = new int[](x, (valueFromX as int) => {return 2 * valueFromX;}); println(y[0]);

@jaredlll08 jaredlll08 merged commit 4bbd17d into development Nov 23, 2023
@jaredlll08
Copy link
Member Author

This PR was inadvertently merged due to committing to the wrong branch, the push has been reverted and a new PR has been made to track this.
#123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants