JSAbrahams / mamba

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

Type `Complex` is not recognized #187

Closed JSAbrahams closed 4 years ago

JSAbrahams commented 4 years ago

Description of Bug

Complex is not recognized.

How to Reproduce

Complex(2,3)

Expected behaviour

The above should be treated as a constructor for the Complex class

JSAbrahams commented 4 years ago

This has been partially rectified by fixing how class arguments are constructed in the Context (and by modifying some application logic for consistency as well).

However, we run into the issue that the desugar stage has no way of knowing when we have a constructor, which is troublesome when we attempt to use the Complex constructor as this should be desugared to complex, whereas a function which is not a constructor should remain untouched.

Therefore, we need a mechanism for modifying our AST during the type-checking phase so we can desugar functions as either constructor invocations or as normal functions. So we need to implement #165 first.

JSAbrahams commented 4 years ago

Once merged, this fixes #186