Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

peer type resolution for *@Frame(func), anyframe->T, and anyframe #3078

Open
andrewrk opened this issue Aug 16, 2019 · 0 comments
Open

peer type resolution for *@Frame(func), anyframe->T, and anyframe #3078

andrewrk opened this issue Aug 16, 2019 · 0 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Milestone

Comments

@andrewrk
Copy link
Member

const std = @import("std");
const expect = std.testing.expect;

test "peer type resolution of *@Frame(func) and anyframe->T and anyframe" {
    var f2_frame = async f2();

    var x: @Frame(func) = async func();
    var y: anyframe->i32 = &f2_frame;
    var z: anyframe = &x;

    var runtime: i8 = 1;
    var result = switch (runtime) {
        0 => &x,
        1 => y,
        else => z,
    };
    comptime expect(@typeOf(result) == anyframe);
    expect(result == y);

    var result2 = switch (runtime) {
        0 => &x,
        else => z,
    };
    comptime expect(@typeOf(result2) == anyframe);
    expect(result2 == z);

    var result3 = switch (runtime) {
        0 => &x,
        else => y,
    };
    comptime expect(@typeOf(result3) == anyframe->i32);
    expect(result3 == y);
}

fn func() i32 {
    return 1234;
}
fn f2() i32 {
    return 4;
}
@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. stage1 The process of building from source via WebAssembly and the C backend. labels Aug 16, 2019
@andrewrk andrewrk added this to the 0.5.0 milestone Aug 16, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 20, 2019
@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Feb 11, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Oct 14, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@Vexu Vexu removed stage1 The process of building from source via WebAssembly and the C backend. labels Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase.
Projects
None yet
Development

No branches or pull requests

2 participants