[Chapel Merge] dyno: add and resolve enums

Branch: refs/heads/main
Revision: ff42bdb
Author: DanilaFe
Link: Unavailable
Log Message:

Merge pull request #20145 from DanilaFe/enum-types

dyno: add and resolve enums

This PR adds enumeration types and params to dyno. This is mainly motivated by the
fact that ranges use an enum BoundedRangeType as a param, and thus to resolve
ranges we need to know how to handle enums. The changes are roughly as follows:

  • Add a new EnumType subclass to Type.
  • Also add an EnumParam to represent type-level occurrences of enum elements.
    Where other *Param classes refer to the exact value of the number they represent,
    the EnumParam refers to the AST ID that declares the represented element.
    • The conversion to an Immediate is left unimplemented at this time, since it
      seems like such conversions are mostly used for folding primitive operations.
  • Resolve references to enums in code!

In short, the following program now resolves fine:

enum color { red, green, blue }
var x = color.red;
Modified Files:
A compiler/dyno/include/chpl/types/EnumType.h

A compiler/dyno/lib/types/EnumType.cpp
A compiler/dyno/test/resolution/testEnums.cpp
M compiler/dyno/include/chpl/types/Param.h
M compiler/dyno/include/chpl/types/all-types.h
M compiler/dyno/include/chpl/types/param-classes-list.h
M compiler/dyno/lib/resolution/Resolver.cpp
M compiler/dyno/lib/resolution/intents.cpp
M compiler/dyno/lib/resolution/resolution-queries.cpp
M compiler/dyno/lib/types/CMakeLists.txt
M compiler/dyno/lib/types/Makefile.include
M compiler/dyno/lib/types/Param.cpp
M compiler/dyno/test/resolution/CMakeLists.txt

Compare: https://github.com/chapel-lang/chapel/compare/eafb97ff261e...ff42bdb3a0b3