New Issue: Add support for ranges over enums with a single value

17464, "bradcray", "Add support for ranges over enums with a single value", "2021-03-25T22:41:18Z"

Summary of Problem

Given an enum with a single value:

enum color { red };

ranges over that enum don't currently work:

const r =;

The root cause of this is that we don't have a good way to represent an empty range over the enum type since we usually use two distinct values to represent the empty range (e.g., [the 1st element in the enum]..[the 0th element in the enum]). But in cases where we require no default initialization (like tests 2 and 3 below), should this actually be a problem?

Associated Future Test(s):
test/types/range/enum/singleValEnum.chpl #13655
test/types/range/enum/singleValEnum2.chpl #13655
test/types/range/enum/singleValEnum3.chpl #TODO

Configuration Information

  • Output of chpl --version: chpl version 1.25.0 pre-release (cf3ecc7466)