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

"Create procedure": Handle return value type and length #41

Closed
NKarolak opened this issue May 19, 2020 · 9 comments
Closed

"Create procedure": Handle return value type and length #41

NKarolak opened this issue May 19, 2020 · 9 comments
Labels
available in next release bug Something isn't working

Comments

@NKarolak
Copy link

    procedure MyFunction()
    var      
        MyCode5Variable: Code[5];
    begin
        MyCode5Variable := MyNewFunction('CCCCC');     // missing
    end;

"Create procedure":
Currently:

 local procedure MyNewFunction(arg: Text): Variant
    begin
        Error('Procedure not implemented.');
    end;

Expected:

 local procedure MyNewFunction(arg: Text): Code[5]
    begin
        Error('Procedure not implemented.');
    end;

That would be great :)

@DavidFeldhoff
Copy link
Owner

Thanks :) I'll look into that and keep you posted!

@DavidFeldhoff
Copy link
Owner

I just tried it with this exact example, but I couldn't reproduce it as it recognizes the return type correctly. It does even work if I create a procedure as a parameter of another procedure call (so that it takes the type of the parameter) or something like that.
What am I doing wrong? :/

@NKarolak
Copy link
Author

NKarolak commented May 19, 2020

Interesting...
My code sample was actually a simplification, though close to the original. I will try to reproduce it again tomorrow, maybe it's all about a tiny detail only.

BTW, I often see parameter variable names with spaces = in quotation marks.
Are there any plans to create variable names without spaces, in general?

@DavidFeldhoff
Copy link
Owner

You mean that the parameters are always created without spaces and without quotation marks?
I could make it happen.. Good idea :)

@NKarolak
Copy link
Author

Yes, I would prefer that. And Microsoft apparently too 😉

@DavidFeldhoff
Copy link
Owner

Okay, I created a separate issue for that, so that we can focus on the issue addressed here. Hope you can find the detail, so that I can fix that :)

@NKarolak
Copy link
Author

NKarolak commented May 20, 2020

Wow, this was tricky to find out.

Please try again using this code (yes, just an additional line that is commented out - do not change!):

 procedure MyFunction()
    var
        MyCode5Variable: Code[5];
    begin
        // MyCode5Variable := 'CCCCC'; // <--- new line
        MyCode5Variable := MyNewFunction('CCCCC');     // missing
    end;

@DavidFeldhoff
Copy link
Owner

Oh.. Nice one 😆
Thanks for keep trying, I'll look into that tomorrow and fix it 👍

@DavidFeldhoff DavidFeldhoff added bug Something isn't working available in next release labels May 20, 2020
@DavidFeldhoff
Copy link
Owner

DavidFeldhoff commented May 22, 2020

Hi Natalie, I fixed it yesterday with v0.2.5.
Furthermore I found another issue: you opened a few days back an issue regarding usage of a table field which is an enum which I fixed (#36 ) But if the enum was used directly, then it was of type variant again. This is now fixed as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
available in next release bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants