← 输入框|github.com|刷新
Skip to content

Support set types #2024

Closed
Closed

Description

@rebcabin

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.

Activity

  1. added
    enhancement
    severe
    on Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementsevere

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions