(Closes #1590) Add support for complex numbers - #3554
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3554 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 397 399 +2
Lines 55790 56094 +304
==========================================
+ Hits 55790 56094 +304 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
complex typescomplex types
complex typescomplex numbers
|
Before reviewing I'll just set CI running in case it flags anything. I had a quick look to check that we hadn't missed anything obvious. |
LonelyCat124
left a comment
There was a problem hiding this comment.
@mn416 I didn't get to reviewing all the tests, I have some concerns about whether or not ComplexLiteral should subclass Literal. I've asked for input from Sergi and Andy as they have time - I don't think we should change it just from my current thoughts as without the usecases for .walk hitting Litearl I'm not sure. Its perhaps enough to have some Mixin that both inherit (so they are generally separate but you can do .walk(LiteralMixin) if you really want them all.
|
Thank-you very much @LonelyCat124. I think I've addressed all outstanding comments. I'll pass it back to you. |
LonelyCat124
left a comment
There was a problem hiding this comment.
@mn416 Almost there, a couple more small changes.
|
Thanks @LonelyCat124, another bug squashed. Back to you. |
|
I'm going to set the ITs going again. I was wondering whether we should have some compliation tests, but I didn't find anywhere appropriate for them so I think we can leave them for now - hopefully with NEMO having some complex requirements soon we can build that into the ITs. |
|
Its all green, I'll merge in the morning, feel free to go ahead if anything else is ready before. |
Closes #1590.
This PR:
Adds a new
ScalarType.Intrinsic.COMPLEXenumeration value.Adds a new
ComplexLiteralPSyIR node, as complex literals are not a good fit for the existingLiteralclass (they are a composite structure which can contain named constants, and are not suitable for representation as a textual string like other literal values).Updates the frontend and backend to use/handle these new constructs.
Fixes all the tests that previously assumed
complextypes would lead toUnsupportedFortranType. In all cases I simply replacecomplexwithbyte.Adds tests for the new functionality.