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

Higher-order generic functions disobey kind system #1037

Closed
brson opened this issue Oct 13, 2011 · 2 comments
Closed

Higher-order generic functions disobey kind system #1037

brson opened this issue Oct 13, 2011 · 2 comments
Labels
A-type-system Area: Type system

Comments

@brson
Copy link
Contributor

brson commented Oct 13, 2011

fn spawn2<@T>(x: T, f: fn(T))  {
    f(x);
}

fn main() {
    fn foo<~T>(x: T) {
        log_err x;
    }

    spawn2::<@int>(@10, foo);
}

spawn2 is passing a shared kind to a function that only takes unique kinds.

@brson
Copy link
Contributor Author

brson commented Oct 13, 2011

There are probably similar issues with other generic types.

@ghost ghost assigned marijnh Nov 15, 2011
@marijnh
Copy link
Contributor

marijnh commented Nov 18, 2011

The restriction on taking the value of generics is currently making this impossible to reproduce.

But even ignoring that, and updating the example to the new terminology, the current kind checker would catch that foo is being instantiated with a type that it doesn't accept. Closing (by #1177)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system
Projects
None yet
Development

No branches or pull requests

2 participants