JSAbrahams / mamba

🐍 The Mamba programming language, because we care about safety
MIT License
85 stars 3 forks source link

Add new assign tokens and check nested calls #294

Closed JSAbrahams closed 2 years ago

JSAbrahams commented 2 years ago

Relevant issues

Closes #277 . Closes #276 .

Summary

Added Tests

codecov[bot] commented 2 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (develop@06ff398). Click here to learn what that means. The diff coverage is n/a.

@@            Coverage Diff             @@
##             develop     #294   +/-   ##
==========================================
  Coverage           ?   86.40%           
==========================================
  Files              ?      100           
  Lines              ?    10000           
  Branches           ?        0           
==========================================
  Hits               ?     8640           
  Misses             ?     1360           
  Partials           ?        0           

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

JSAbrahams commented 2 years ago

Hm test coverage has dropped from ~85.56 to 85.46 as of writing. I can't imagine that this is only due to the type checker's new behaviour not being tested right now (which is two if statements in total since we haven't yet implemented any logic besides "throw error message"). So, clearly I'm missing more than just that, so need to double check the considerable drop.

JSAbrahams commented 2 years ago

Coverage jumped back up to 86,07%, which does somewhat support a hunch I've had where we didn't test property access enough which has allowed a lot of weird behaviour to slip through.

Good thing is that it's systemic, so if we fix it then it should have a knock-on effect and fix a lot of other issues with the language. Fixing this will in particular become more important as we start to test compilation of larger projects with many nested classes, which the current checker cannot handle (at all). I guess this is my fault for only testing simple scripts and not setting up a more complex project. Though arguably that would've been more effort than its worth since you have to be very careful about which language features you include.

JSAbrahams commented 2 years ago

Currently working on identifier. Should've been an enum from the start, similar to Name. Once the new logic has been implemented, the checker should work properly for nested calls as it will check types recursively in such situations.

JSAbrahams commented 2 years ago

Should resolve final small issues and then merge. The remaining tests which have been ignored should be noted in the issue, and we should fix that in the next PR. This prevents everything being fixed in this one PR.

After that, we can start looking at how to generate python match statements (which I believe was introduced in Python v3.9, so we might need to think about how we deal with that in terms of parsing Python code, for which we use a dependency which goes up to v3.8 it seems).