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

funcdef assignment causes errors (+ invoking funcdef as member) #47

Open
Paril opened this issue Jan 1, 2025 · 1 comment
Open

funcdef assignment causes errors (+ invoking funcdef as member) #47

Paril opened this issue Jan 1, 2025 · 1 comment

Comments

@Paril
Copy link

Paril commented Jan 1, 2025

funcdef's are one of the weirder AS types, since they are handles but they can't be directly "assigned" to (that is to say, F @d; d = a; is an error, apparently because they are const but I wish it would allow it to just act as a regular handle assignment).

Anyways, assignment in any context is busted for them, and secondarily the langserv reports an error if attempting to invoke a funcdef value from a class.

class Bar
{
    foo_f @f;
}

funcdef void foo_f(Bar &);

void foo_impl(Bar &)
{
}

void f(foo_f @)
{
}

void test()
{
    Bar b;
    foo_f @func;

    // error: Invalid operation 'opAssign' between 'void(Bar)@' and 'void(Bar)'
    // but is valid AS.
    @func = foo_impl;

    // no error; correct
    func(b);

    // error: Cannot convert 'void(Bar)@' to parameter type 'void(Bar)@'
    // but is valid AS.
    f(func);

    // error: Invalid operation 'opAssign' between 'void(Bar)@' and 'void(Bar)'
    // but is valid AS.
    @b.f = foo_impl;

    // error: 'f' is not a method.
    // but is valid AS
    b.f(b);

    // error: Invalid operation 'opAssign' between 'void(Bar)@' and 'void(Bar)'.
    // this is correct error and AS will error on this line.
    // AS Error: ERR  : Can't implicitly convert from 'foo_f@const' to 'const foo_f&'.
    func = foo_impl;
}
@Paril Paril changed the title funcdef assignment causes errors funcdef assignment causes errors (+ invoking funcdef as member) Jan 1, 2025
@Paril
Copy link
Author

Paril commented Jan 5, 2025

As an addendum: this also affects is and !is operations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant