| ... | @@ -354,7 +354,7 @@ test "std.meta.trait.isConstPtr" { | ... | @@ -354,7 +354,7 @@ test "std.meta.trait.isConstPtr" { |
| 354 | | 354 | |
| 355 | pub fn isContainer(comptime T: type) bool { | 355 | pub fn isContainer(comptime T: type) bool { |
| 356 | return switch (@typeInfo(T)) { | 356 | return switch (@typeInfo(T)) { |
| 357 | .Struct, .Union, .Enum => true, | 357 | .Struct, .Union, .Enum, .Opaque => true, |
| 358 | else => false, | 358 | else => false, |
| 359 | }; | 359 | }; |
| 360 | } | 360 | } |
| ... | @@ -368,10 +368,12 @@ test "std.meta.trait.isContainer" { | ... | @@ -368,10 +368,12 @@ test "std.meta.trait.isContainer" { |
| 368 | A, | 368 | A, |
| 369 | B, | 369 | B, |
| 370 | }; | 370 | }; |
| | 371 | const TestOpaque = opaque {}; |
| 371 | | 372 | |
| 372 | try testing.expect(isContainer(TestStruct)); | 373 | try testing.expect(isContainer(TestStruct)); |
| 373 | try testing.expect(isContainer(TestUnion)); | 374 | try testing.expect(isContainer(TestUnion)); |
| 374 | try testing.expect(isContainer(TestEnum)); | 375 | try testing.expect(isContainer(TestEnum)); |
| | 376 | try testing.expect(isContainer(TestOpaque)); |
| 375 | try testing.expect(!isContainer(u8)); | 377 | try testing.expect(!isContainer(u8)); |
| 376 | } | 378 | } |
| 377 | | 379 | |