Skip to content

Conversation

ansharlubis
Copy link
Collaborator

No description provided.

@certik
Copy link
Contributor

certik commented Jun 18, 2022

Can you please resolve conflicts and add tests?

@ansharlubis
Copy link
Collaborator Author

ansharlubis commented Jun 20, 2022

About the conflict, I'm not sure what CPtr() and boolop are, so I can't decide on what should be done with those.

About the tests, currently there is no code generation for type variables, so what kind of test should I make? Also I am not familiar with the steps to add tests.

@certik
Copy link
Contributor

certik commented Jun 20, 2022

@ansharlubis see if you can rebase this on top of the latest main. Simply at the end, your additions should look the same, just on top of the latest main. Start with that. Then we can talk about tests. If you get stuck, please let me know right away, and I'll help.

@@ -317,6 +317,10 @@ ttype
| Dict(ttype key_type, ttype value_type)
| Pointer(ttype type)
| CPtr()
| TypeVar(string var)

boolop = And | Or | Xor | NEqv | Eqv
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably remove this, we don't need it for this PR.

Copy link
Collaborator Author

@ansharlubis ansharlubis Jun 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need the | TypeVar(String var) for handling type variable declaration.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need TypeVar, but you do not need the extra boolop.

@certik
Copy link
Contributor

certik commented Jun 20, 2022

Now when it is merged with the latest main, the next step is to add a test for this. I think this takes Python code and converts it to ASR? If so, then add a test into the tests directory and register it in tests.toml.

@ansharlubis
Copy link
Collaborator Author

Now when it is merged with the latest main, the next step is to add a test for this. I think this takes Python code and converts it to ASR? If so, then add a test into the tests directory and register it in tests.toml.

How do I define the reference for the test?

@certik
Copy link
Contributor

certik commented Jun 20, 2022

You run ./run_tests.py -u, it will generate it. Then you commit it to git.

@ansharlubis
Copy link
Collaborator Author

I seem to run into problem with test_numpy_02.py where TypeVar was used as follows.

n: i32
n = TypeVar('n')

What is the purpose of TypeVar here?

@certik
Copy link
Contributor

certik commented Jun 20, 2022

In there the purpose is to declare n so that it can be used in type annotations for arrays.

@certik
Copy link
Contributor

certik commented Jul 6, 2022

@certik
Copy link
Contributor

certik commented Jul 6, 2022

TODO:

  • Implement function duplication, with a name change
  • Go into the new function and change all templates T to the new type
  • Call the new function
  • Update the unused function visitor to remove all templated functions, so that it can be compiled with the LLVM backend.

@@ -0,0 +1,57 @@
Traceback (most recent call last):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be removed.

tests/tests.toml Outdated
[[test]]
filename = "../integration_tests/generics_01.py"
asr = true
llvm = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to test llvm, since we are not modifying anything in the backend. Rather, let's add an integration test, to ensure it builds and runs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got it. I've already added the integration test.

tests/tests.toml Outdated
[[test]]
filename = "../integration_tests/generics_array_01.py"
asr = true
llvm = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, let's add an integration test and remove llvm here.

Keep testing asr, that is good.

@certik
Copy link
Contributor

certik commented Aug 1, 2022

What is the status of this and #831? Let's get it finished so that we can merge.

@ansharlubis
Copy link
Collaborator Author

What is the status of this and #831? Let's get it finished so that we can merge.

Both pass the checks. But this PR and #831 have different ASR structures.

@certik
Copy link
Contributor

certik commented Aug 4, 2022

We do not need to work on this one, since we are merging #831, so I'll close this one.

@certik certik closed this Aug 4, 2022
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

Successfully merging this pull request may close these issues.

3 participants