The error message for the second case isn't as clear as it could be, if you don't know what to look for maybe. It says: Error: type mismatch: got <set[range 0..65535(int)]> but expected 'CharSet = set[int16]' Run
See the (int) after the range ...? That tells you the type it gets is actually of type int. Your set however takes int16. So to make it work you have to give explicit int16 literals: x = {1'i16..9'i16, 15'i16, 45'i16..78'i16} Run