Skip to content

Commit d3d3f78

Browse files
authored
Merge pull request #6 from nilslice/0.14.0-update
ci: add zig version 0.14.0
2 parents 33a939d + 8515551 commit d3d3f78

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ jobs:
1212
strategy:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
15+
zig-version: ["0.14.1"]
1516

1617
steps:
1718
- uses: actions/checkout@v3
1819

1920
- name: Install Zig
2021
uses: goto-bus-stop/setup-zig@v2
2122
with:
22-
version: 0.13.0
23+
version: ${{ matrix.zig-version }}
2324

2425
- name: Check Zig Version
2526
run: zig version

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
zig-cache
2-
zig-out
1+
.zig-cache
2+
.zig-out

build.zig.zon

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
.{
2-
.name = "interface",
2+
.fingerprint = 0x34f4ecdd27565918,
3+
.name = .interface,
34
// This is a [Semantic Version](https://semver.org/).
45
// In a future version of Zig it will be used for package deduplication.
5-
.version = "0.0.1",
6+
.version = "0.0.2",
67

78
// This field is optional.
89
// This is currently advisory only; Zig does not yet do anything

src/interface.zig

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ fn isTypeCompatible(comptime T1: type, comptime T2: type) bool {
1212
if (@intFromEnum(info1) != @intFromEnum(info2)) return false;
1313

1414
return switch (info1) {
15-
.Struct => |s1| blk: {
16-
const s2 = @typeInfo(T2).Struct;
15+
.@"struct" => |s1| blk: {
16+
const s2 = @typeInfo(T2).@"struct";
1717
if (s1.fields.len != s2.fields.len) break :blk false;
1818
if (s1.is_tuple != s2.is_tuple) break :blk false;
1919

@@ -23,8 +23,8 @@ fn isTypeCompatible(comptime T1: type, comptime T2: type) bool {
2323
}
2424
break :blk true;
2525
},
26-
.Enum => |e1| blk: {
27-
const e2 = @typeInfo(T2).Enum;
26+
.@"enum" => |e1| blk: {
27+
const e2 = @typeInfo(T2).@"enum";
2828
if (e1.fields.len != e2.fields.len) break :blk false;
2929

3030
for (e1.fields, e2.fields) |f1, f2| {
@@ -33,20 +33,20 @@ fn isTypeCompatible(comptime T1: type, comptime T2: type) bool {
3333
}
3434
break :blk true;
3535
},
36-
.Array => |a1| blk: {
37-
const a2 = @typeInfo(T2).Array;
36+
.array => |a1| blk: {
37+
const a2 = @typeInfo(T2).array;
3838
if (a1.len != a2.len) break :blk false;
3939
break :blk isTypeCompatible(a1.child, a2.child);
4040
},
41-
.Pointer => |p1| blk: {
42-
const p2 = @typeInfo(T2).Pointer;
41+
.pointer => |p1| blk: {
42+
const p2 = @typeInfo(T2).pointer;
4343
if (p1.size != p2.size) break :blk false;
4444
if (p1.is_const != p2.is_const) break :blk false;
4545
if (p1.is_volatile != p2.is_volatile) break :blk false;
4646
break :blk isTypeCompatible(p1.child, p2.child);
4747
},
48-
.Optional => |o1| blk: {
49-
const o2 = @typeInfo(T2).Optional;
48+
.optional => |o1| blk: {
49+
const o2 = @typeInfo(T2).optional;
5050
break :blk isTypeCompatible(o1.child, o2.child);
5151
},
5252
else => T1 == T2,
@@ -170,8 +170,8 @@ fn formatTypeMismatch(
170170
///
171171
pub fn Interface(comptime methods: anytype, comptime embedded: anytype) type {
172172
const embedded_interfaces = switch (@typeInfo(@TypeOf(embedded))) {
173-
.Null => embedded,
174-
.Struct => |s| if (s.is_tuple) embedded else .{embedded},
173+
.null => embedded,
174+
.@"struct" => |s| if (s.is_tuple) embedded else .{embedded},
175175
else => .{embedded},
176176
};
177177

@@ -325,12 +325,12 @@ pub fn Interface(comptime methods: anytype, comptime embedded: anytype) type {
325325
const exp_info = @typeInfo(Expected);
326326
const act_info = @typeInfo(Actual);
327327

328-
if (exp_info != .ErrorUnion or act_info != .ErrorUnion) {
328+
if (exp_info != .error_union or act_info != .error_union) {
329329
return Expected == Actual;
330330
}
331331

332-
if (exp_info.ErrorUnion.error_set == anyerror) {
333-
return exp_info.ErrorUnion.payload == act_info.ErrorUnion.payload;
332+
if (exp_info.error_union.error_set == anyerror) {
333+
return exp_info.error_union.payload == act_info.error_union.payload;
334334
}
335335
return Expected == Actual;
336336
}
@@ -366,8 +366,8 @@ pub fn Interface(comptime methods: anytype, comptime embedded: anytype) type {
366366
const impl_fn = @TypeOf(@field(Type, field.name));
367367
const expected_fn = @field(methods, field.name);
368368

369-
const impl_info = @typeInfo(impl_fn).Fn;
370-
const expected_info = @typeInfo(expected_fn).Fn;
369+
const impl_info = @typeInfo(impl_fn).@"fn";
370+
const expected_info = @typeInfo(expected_fn).@"fn";
371371

372372
if (impl_info.params.len != expected_info.params.len) {
373373
problems = problems ++ &[_]Incompatibility{.{

0 commit comments

Comments
 (0)