Skip to content
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

Support set types #2024

Closed
rebcabin opened this issue Jun 25, 2023 · 0 comments · Fixed by #2122
Closed

Support set types #2024

rebcabin opened this issue Jun 25, 2023 · 0 comments · Fixed by #2122
Assignees
Labels
enhancement New feature or request severe not blocker, but causes undesirable workarounds

Comments

@rebcabin
Copy link
Contributor

rebcabin commented Jun 25, 2023

The following generates a good error message, but the lack of set types is a severe limiitation.

INTEGER_KINDS   : set[i32] = {1, 2, 4, 8}
LOGICAL_KINDS   : set[i32] = {1, 2, 4}
REAL_KINDS      : set[i32] = {4, 8}
COMPLEX_KINDS   : set[i32] = {4, 8}
CHARACTER_KINDS : set[i32] = {1}
/Users/brian/CLionProjects/lpython/src/bin/python /Users/brian/CLionProjects/lpython/lasr/LP-pycharm/lasr_parser.py 
code generation error: Variable type not supported 6
  --> /Users/brian/CLionProjects/lpython/lasr/LP-pycharm/lasr_parser.py:58:1
   |
58 | CHARACTER_KINDS : set[i32] = {1}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

The workaround is undesirable (that's what "severe" means):

INTEGER_KINDS   : dict[i32, i32] = {1: 1, 2: 2, 4: 4, 8: 8}
LOGICAL_KINDS   : dict[i32, i32] = {1: 1, 2: 2, 4: 4}
REAL_KINDS      : dict[i32, i32] = {4: 4, 8: 8}
COMPLEX_KINDS   : dict[i32, i32] = {4: 4, 8: 8}
CHARACTER_KINDS : dict[i32, i32] = {1: 1}

The workaround hints at a possible easy fix.

@rebcabin rebcabin added enhancement New feature or request severe not blocker, but causes undesirable workarounds labels Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request severe not blocker, but causes undesirable workarounds
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants