| 1 | vlib/v/checker/tests/enum_field_value_overflow.vv:3:10: error: enum value `2147483648` overflows the enum type `i32`, values of which have to be in [-2147483648, 2147483647] |
| 2 | 1 | enum Color as i32 { |
| 3 | 2 | red |
| 4 | 3 | green = 2147483648 |
| 5 | | ~~~~~~~~~~ |
| 6 | 4 | blue |
| 7 | 5 | } |
| 8 | vlib/v/checker/tests/enum_field_value_overflow.vv:7:21: error: `string` is not one of `i8`,`i16`,`i32`,`int`,`i64`,`u8`,`u16`,`u32`,`u64` |
| 9 | 5 | } |
| 10 | 6 | |
| 11 | 7 | enum ColorString as string { |
| 12 | | ~~~~~~ |
| 13 | 8 | red |
| 14 | 9 | green = 'abc' |
| 15 | vlib/v/checker/tests/enum_field_value_overflow.vv:9:10: error: the default value for an enum has to be an integer |
| 16 | 7 | enum ColorString as string { |
| 17 | 8 | red |
| 18 | 9 | green = 'abc' |
| 19 | | ~~~~~ |
| 20 | 10 | blue |
| 21 | 11 | } |
| 22 | vlib/v/checker/tests/enum_field_value_overflow.vv:10:2: error: enum value overflows type `string`, which has a maximum value of 0 |
| 23 | 8 | red |
| 24 | 9 | green = 'abc' |
| 25 | 10 | blue |
| 26 | | ~~~~ |
| 27 | 11 | } |
| 28 | 12 | |
| 29 | vlib/v/checker/tests/enum_field_value_overflow.vv:15:10: error: enum value `128` overflows the enum type `i8`, values of which have to be in [-128, 127] |
| 30 | 13 | enum ColorI8 as i8 { |
| 31 | 14 | red |
| 32 | 15 | green = 128 |
| 33 | | ~~~ |
| 34 | 16 | blue |
| 35 | 17 | } |
| 36 | vlib/v/checker/tests/enum_field_value_overflow.vv:21:10: error: enum value `32769` overflows the enum type `i16`, values of which have to be in [-32768, 32767] |
| 37 | 19 | enum ColorI16 as i16 { |
| 38 | 20 | red |
| 39 | 21 | green = 32769 |
| 40 | | ~~~~~ |
| 41 | 22 | blue |
| 42 | 23 | } |
| 43 | vlib/v/checker/tests/enum_field_value_overflow.vv:27:10: error: enum value `2147483648` overflows the enum type `i32`, values of which have to be in [-2147483648, 2147483647] |
| 44 | 25 | enum ColorI32 as i32 { |
| 45 | 26 | red |
| 46 | 27 | green = 2147483648 |
| 47 | | ~~~~~~~~~~ |
| 48 | 28 | blue |
| 49 | 29 | } |
| 50 | vlib/v/checker/tests/enum_field_value_overflow.vv:33:10: error: enum value `9223372036854775808` overflows the enum type `i64`, values of which have to be in [-9223372036854775808, 9223372036854775807] |
| 51 | 31 | enum ColorI64 as i64 { |
| 52 | 32 | red |
| 53 | 33 | green = 9223372036854775808 |
| 54 | | ~~~~~~~~~~~~~~~~~~~ |
| 55 | 34 | blue |
| 56 | 35 | } |
| 57 | vlib/v/checker/tests/enum_field_value_overflow.vv:34:2: error: enum value overflows type `i64`, which has a maximum value of 9223372036854775807 |
| 58 | 32 | red |
| 59 | 33 | green = 9223372036854775808 |
| 60 | 34 | blue |
| 61 | | ~~~~ |
| 62 | 35 | } |
| 63 | 36 | |
| 64 | vlib/v/checker/tests/enum_field_value_overflow.vv:56:10: error: enum value `256` overflows the enum type `u8`, values of which have to be in [0, 255] |
| 65 | 54 | // These should work however, since the type is unsigned: |
| 66 | 55 | enum ColorU8ShouldFail as u8 { |
| 67 | 56 | green = 256 |
| 68 | | ~~~ |
| 69 | 57 | } |
| 70 | 58 | |
| 71 | vlib/v/checker/tests/enum_field_value_overflow.vv:60:10: error: enum value `65536` overflows the enum type `u16`, values of which have to be in [0, 65535] |
| 72 | 58 | |
| 73 | 59 | enum ColorU16ShouldFail as u16 { |
| 74 | 60 | green = 65536 |
| 75 | | ~~~~~ |
| 76 | 61 | } |
| 77 | 62 | |
| 78 | vlib/v/checker/tests/enum_field_value_overflow.vv:64:10: error: enum value `4294967296` overflows the enum type `u32`, values of which have to be in [0, 4294967295] |
| 79 | 62 | |
| 80 | 63 | enum ColorU32ShouldFail as u32 { |
| 81 | 64 | green = 4294967296 |
| 82 | | ~~~~~~~~~~ |
| 83 | 65 | } |
| 84 | 66 | |
| 85 | vlib/v/checker/tests/enum_field_value_overflow.vv:68:10: error: enum value `18446744073709551616` overflows the enum type `u64`, values of which have to be in [0, 18446744073709551615] |
| 86 | 66 | |
| 87 | 67 | enum ColorU64ShouldFail as u64 { |
| 88 | 68 | green = 18446744073709551616 |
| 89 | | ~~~~~~~~~~~~~~~~~~~~ |
| 90 | 69 | } |
| 91 | |