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

ability to obtain return type of generic function when it has no dependencies #846

Open
Hejsil opened this Issue Mar 20, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@Hejsil
Member

Hejsil commented Mar 20, 2018

test "" {
    var t: @typeOf(@import("std").fmt.parseInt).ReturnType = undefined;
}
zsh: segmentation fault (core dumped)  zig test test.zig

@Hejsil Hejsil added the bug label Mar 20, 2018

@andrewrk

This comment has been minimized.

Member

andrewrk commented Mar 20, 2018

I believe this is related to parseInt being a generic function

@Hejsil

This comment has been minimized.

Member

Hejsil commented Mar 20, 2018

Oooh ye, that might be it. Tried a few other functions like allocPrint, but ofc, that is also generic.

Here is the bare bones version:

fn a(b: var) void {}

test "" {
    var c : @typeOf(a).ReturnType = undefined;
}

@Hejsil Hejsil changed the title from Getting the return type from a function in the standard library causes seg fault. to Getting the return type from a generic function causes seg fault. Mar 20, 2018

@andrewrk andrewrk added this to the 0.3.0 milestone Mar 21, 2018

Hejsil added a commit that referenced this issue Apr 28, 2018

@Hejsil

This comment has been minimized.

Member

Hejsil commented Apr 28, 2018

@andrewrk Do we mark this as fixed? The compiler doesn't crash on anymore and gives an error message instead.

The real question, if my bare bones example should work or not. After all, void is known, even if b is generic. The compiler just doesn't analyze past b. It's probably a complicated thing to make work, so maybe not.

@andrewrk

This comment has been minimized.

Member

andrewrk commented Aug 27, 2018

The real question, if my bare bones example should work or not.

I'm not sure. It's a difficult question that I'm not prepared to address yet. Let's revisit closer to 1.0.0.

@andrewrk andrewrk changed the title from Getting the return type from a generic function causes seg fault. to unable to obtain return type of generic function even when has no dependencies Aug 27, 2018

@andrewrk andrewrk added proposal and removed bug labels Aug 27, 2018

@andrewrk andrewrk changed the title from unable to obtain return type of generic function even when has no dependencies to ability to obtain return type of generic function when it has no dependencies Aug 27, 2018

@andrewrk andrewrk modified the milestones: 0.3.0, 0.4.0 Aug 27, 2018

@andrewrk andrewrk modified the milestones: 0.4.0, 0.5.0 Nov 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment