| author | |
| committer | |
| log | f8de4db8731e20995d16ec29bc0fb553e7d6f5bf |
| tree | 188a3e11471df9f7c31bdb3a23a232b38c810adb |
| parent | 9c550721e40f50b2ee44a5b1bf633ebdd50d5fd2 |
3 files changed, 11 insertions(+), 6 deletions(-)
src/codegen/spirv.zig+11| ... | @@ -369,6 +369,17 @@ pub const DeclGen = struct { | ... | @@ -369,6 +369,17 @@ pub const DeclGen = struct { |
| 369 | .composite_integer, | 369 | .composite_integer, |
| 370 | }; | 370 | }; |
| 371 | }, | 371 | }, |
| 372 | .Enum => blk: { | ||
| 373 | var buffer: Type.Payload.Bits = undefined; | ||
| 374 | const int_ty = ty.intTagType(&buffer); | ||
| 375 | const int_info = int_ty.intInfo(target); | ||
| 376 | break :blk ArithmeticTypeInfo{ | ||
| 377 | .bits = int_info.bits, | ||
| 378 | .is_vector = false, | ||
| 379 | .signedness = int_info.signedness, | ||
| 380 | .class = .integer, | ||
| 381 | }; | ||
| 382 | }, | ||
| 372 | // As of yet, there is no vector support in the self-hosted compiler. | 383 | // As of yet, there is no vector support in the self-hosted compiler. |
| 373 | .Vector => self.todo("implement arithmeticTypeInfo for Vector", .{}), | 384 | .Vector => self.todo("implement arithmeticTypeInfo for Vector", .{}), |
| 374 | // TODO: For which types is this the case? | 385 | // TODO: For which types is this the case? |
test/behavior/enum.zig-5| ... | @@ -27,7 +27,6 @@ const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; | ... | @@ -27,7 +27,6 @@ const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; |
| 27 | test "int to enum" { | 27 | test "int to enum" { |
| 28 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 28 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 29 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 29 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 30 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | ||
| 31 | 30 | ||
| 32 | try testIntToEnumEval(3); | 31 | try testIntToEnumEval(3); |
| 33 | } | 32 | } |
| ... | @@ -576,8 +575,6 @@ test "enum literal equality" { | ... | @@ -576,8 +575,6 @@ test "enum literal equality" { |
| 576 | } | 575 | } |
| 577 | 576 | ||
| 578 | test "enum literal cast to enum" { | 577 | test "enum literal cast to enum" { |
| 579 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | ||
| 580 | |||
| 581 | const Color = enum { Auto, Off, On }; | 578 | const Color = enum { Auto, Off, On }; |
| 582 | 579 | ||
| 583 | var color1: Color = .Auto; | 580 | var color1: Color = .Auto; |
| ... | @@ -874,8 +871,6 @@ test "switch on enum with one member is comptime-known" { | ... | @@ -874,8 +871,6 @@ test "switch on enum with one member is comptime-known" { |
| 874 | } | 871 | } |
| 875 | 872 | ||
| 876 | test "method call on an enum" { | 873 | test "method call on an enum" { |
| 877 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | ||
| 878 | |||
| 879 | const S = struct { | 874 | const S = struct { |
| 880 | const E = enum { | 875 | const E = enum { |
| 881 | one, | 876 | one, |
test/behavior/union.zig-1| ... | @@ -366,7 +366,6 @@ test "simple union(enum(u32))" { | ... | @@ -366,7 +366,6 @@ test "simple union(enum(u32))" { |
| 366 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 366 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 367 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 367 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 368 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 368 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 369 | if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest; | ||
| 370 | 369 | ||
| 371 | var x = MultipleChoice.C; | 370 | var x = MultipleChoice.C; |
| 372 | try expect(x == MultipleChoice.C); | 371 | try expect(x == MultipleChoice.C); |