-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: list initialisation #24277
Comments
Thanks for reporting! For those that didn't track the email thread, this can be worked around by writing
or
For the future implementer, we think making a new |
This looks to be pretty low-hanging fruit, see the diff here: main...jabraham17:chapel:list-from-nested-array. This actually allows multiple levels of nesting, so a |
This PR allows creating a `list` of `list`s from an array of arrays. Previosuly, the following resulted in a confusing error to users. ```chapel var a: list(list(string)) = [["a", "b"], ["c", "d"]]; ``` To resolve the issue, users needed to write the following to workaround this. ```chapel var a: list(list(string)) = [new list(["a", "b"]), new list(["c", "d"])]; ``` This PR extends the existing code that allows implicit list creation from arrays to handled arrays and arrays, so that both of the above code snippets work the same. This is also extendable to arrays of arrays of arrays. Testing - [x] paratest without comm - [x] paratest with comm Resolves #24277 [Reviewed by @lydia-duncan]
Initialisation of a list using this syntax does not compile.
var lst3 : list(list(string)) = [["this", "that", "the other"],["one","two","three"]];
Summary of Problem
The text was updated successfully, but these errors were encountered: