Skip to content

Conversation

@jaredlll08
Copy link
Member

Remake of #122 due to accidental merging.

@jaredlll08
Copy link
Member Author

jaredlll08 commented Nov 23, 2023

@kindlich

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]);

This PR now has tests for all cases besides the projection function, due to potentially incorrect implementation of the function itself, unrelated to this PR.

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.

Tests pass and #122 already had my approve 😉

@jaredlll08
Copy link
Member Author

The missing tests have been fixed and added

@jaredlll08 jaredlll08 merged commit 58bbc6a into development Nov 24, 2023
@stanhebben stanhebben deleted the bugfix/expansion_generic_signature_2 branch January 12, 2024 20:40
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