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

opConv/opImplConv support #46

Open
Paril opened this issue Jan 1, 2025 · 2 comments
Open

opConv/opImplConv support #46

Paril opened this issue Jan 1, 2025 · 2 comments

Comments

@Paril
Copy link

Paril commented Jan 1, 2025

Hey there.

I'm currently using this for a fairly large project (a conversion of a game module from C++ over to AS) and, to put it mildly, essentially stress-testing this extension, heh. It's pretty good, but I have run into several issues - I thought about opening an issue about each one but that might get kind of spammy, would you rather I send you in-development scripts so you can test against it? Alternatively I can just boil each sample down to smaller issues and blast them all under Issues. Whatever you prefer.

The first major one I ran into is that opConv and opImplConv don't seem to be attempted, which I make heavy use of.

@sashi0034
Copy link
Owner

Thank you for reaching out. I’m glad to hear that you’re using this extension for a large project!

Regarding opConv and opImplConv, thanks for reporting this. I’ll look into it.

If you have other issues, please feel free to report them in whatever way is easiest for you. I don’t mind handling a large number of reports, so please don’t hesitate to share as many problems as you find. Looking forward to your feedback!

@Paril
Copy link
Author

Paril commented Jan 1, 2025

Sounds good - in that case, what I'll do is make minimal repros and open up issues for you. There is one issue that will be hard to describe where I get consistent crashes of the langserv when porting larger functions from C++ to AS; it's not huge since I can just reload the window quickly, but it might be indicative of a larger problem. If there's any way to get you the crash info you need for it let me know how to do that!

For this bug, though, here's a repro:

// NB: this must be registered by the engine, because
// types implemented by script cannot have conversions
// to bool!
class Foo
{
    bool opImplConv() const;
}

class Bar
{
    int opConv() const { return 0; }

    // bug: opConv/opImplConv/opCast/opImplCast is one of the few
    // functions in AS that can actually overload only by return type.
    // I assume this is what causes the error here. 
    string opConv() const { return "0"; }
}

void test()
{
    Foo x;

    // bug: error
    if (x) { }
    // bug: error
    bool xb = x;

    Bar y;
    // this actually works, but I think it's
    // potentially a bug because this works even
    // if opConv isn't defined
    int z = int(y);
    // bug: error. this only considers the constructor
    string a = string(y);
}

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

2 participants