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
Merging function and TemplatedFunction #90
Conversation
Thanks @Oshanath. Here is a TODO:
Ping me if you run into any issues or have any questions. |
Yes, I think you are correct. That part in AST->ASR in LFortran is quite complex already, so we should figure out how to refactor it. For now just do what you can, refactor it for your needs. We'll come back to it later. |
@certik Users call the instantiation by the name of the template. But currently, the name of the template is not stored anywhere. So I think we should either add a new parameter to Functions to store to which template that function belongs to. Or we should create an ASR node called Template to store its name and the type parameters. I think the latter is the better choice. What do you think? |
I see. I need to think about this, also with relation to restrictions, see Zulip. |
@certik I had to change the naming process of the instantiation because the new function name is determined by the user. |
examples/add_m.f90
Outdated
x = 5.1 | ||
y = 7.2 | ||
print*, "The result is ", add_real(x, y) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (abs(add_real(x, y) - 12.3) > 1e-5) error stop | |
examples/add_m.f90
Outdated
a = 5 | ||
b = 9 | ||
print*, "The result is ", add_integer(a, b) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (add_integer(x, y) /= 14) error stop |
ASR::symbol_t* v_orig = ASRUtils::symbol_get_past_external(v); | ||
[2m File "[0m[1m[35m$DIR/src/libasr/asr_utils.h[39m[0m[2m", line 43, in ??[0m | ||
if (f->type == ASR::symbolType::ExternalSymbol) { | ||
[2m Binary file "[0m[1m[35m/lib/x86_64-linux-gnu/libc.so.6[39m[0m[2m", in killpg()[0m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed now.
tests/tests.toml
Outdated
@@ -11,6 +11,11 @@ ast_indent = true | |||
asr_indent = true | |||
ast = true | |||
|
|||
[[test]] | |||
filename = "../examples/add_m.f90" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this test from examples into integration_tests.
This is the latest PR, and it works!!! So all we need is to just polish this up and merge into master. |
216c30a
to
0f46c1e
Compare
e8a93ce
to
745e20a
Compare
@certik I applied your suggestions, moved the example to integration tests and cleaned up the history. |
I went over all commits, everything looks good. Thanks for finishing this up! |
reference tests pass. I checked and as far as I saw only the extra [] for typevars are added to them.
ctest
still dont pass. I will change them next. I will manually generate the ASR for them and paste the result. I checked and there too, the only difference is the extra [] for the typevars.