• 1 Post
  • 4 Comments
Joined 1 year ago
cake
Cake day: July 27th, 2023

help-circle


  • squeaky@lemmy.worldtoZiglang@lemmy.worldUsing expectEqual
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    If we look at the signature expectEqual(expected: anytype, actual: @TypeOf(expected)) !void, notice that the second arg’s type depends on the first arg’s type.

    To avoid using @as coercion, we can just swap the passing arguments. comptime_int can be inferred as i64, not the other way around. And that makes sense because literal values are unsized.