(Closes #2612) add support for length and precision attributes in character type#3377
(Closes #2612) add support for length and precision attributes in character type#3377
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3377 +/- ##
========================================
Coverage 99.95% 99.96%
========================================
Files 387 388 +1
Lines 54317 54485 +168
========================================
+ Hits 54295 54465 +170
+ Misses 22 20 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This is a little bigger than I'd have liked because, in quite a few tests, we use character as a "type that we don't support". I've kicked this can down the road a bit by switching to |
|
|
NEMO v4 IT still fails: |
|
I declare this one ready for review too. I haven't yet had a green run on the NEMOv4 integration tests but I've tried it manually and I think it's OK. We can run the ITs once Aidan's benchmarking is done. |
| |Initialisation |Explicit | Implicit loops, | | ||
| |expressions |initialisation | array constructors | |
There was a problem hiding this comment.
I suppose by supported we mean that it produces an ArrayType datasymbol with the initialisation expression being a CodeBlock?
I am ok with it if that's the case, but to be sure they work, can you add an example of each in src/psyclone/tests/psyir/frontend/fparser2_test.py, in test_process_array_declarations or test_declarations_with_initialisations (unless it is already tested somewhere else, but I couldn't find it)
| # TODO #3240 - sometimes we have an ArrayReference that is | ||
| # actually a character sub-string. | ||
| base_type = self.symbol.datatype.copy() |
There was a problem hiding this comment.
Add a test in src/psyclone/tests/psyir/nodes/array_reference_test.py::test_array_datatype
|
|
||
| def debug_string(self) -> str: | ||
| ''':returns: the name of the Enum item.''' | ||
| return self.name |
There was a problem hiding this comment.
pylint says "Instance of 'ScalarTypeAttribute' has no 'name' member"
Can we make ScalarTypeAttribute inherit from Enum, instead of each subclass having multiple-inheritance?
| class CharLengthParameter(ScalarTypeAttribute, Enum): | ||
| ASTERISK = 1 | ||
| COLON = 2 |
| from psyclone.psyir.nodes.datanode import DataNode | ||
| if isinstance(value, ScalarType.CharLengthParameter): | ||
| self._length = value | ||
| elif isinstance(value, int) and not isinstance(value, bool): |
There was a problem hiding this comment.
Is the and not isinstance(value, bool) necessary?
| f"The length property of a character ScalarType must be an " | ||
| f"int, ScalarType.CharLengthParameter " |
There was a problem hiding this comment.
"a non-negative int ..."
| type(a_type) :: dtype | ||
| type(d_type), pointer :: dtype_ptr | ||
| type(a_type), dimension(10) :: type_list |
There was a problem hiding this comment.
dtype_ptr and type_list are not used in the assignments below, are they needed? or are there assignments missing?
| subroutine test() | ||
| integer :: a | ||
| a = unsupported_type_symbol() | ||
| a = INT(REAL(unsupported_type_symbol())) |
| end subroutine test''' | ||
| psyir = fortran_reader.psyir_from_source(code) | ||
|
|
||
| trans = ArrayAssignment2LoopsTrans() |
There was a problem hiding this comment.
There is a TODO to 2612 in this file line 631.
Also in src/psyclone/psyir/nodes/intrinsic_call.py
794: # TODO 2612 This may be more complex if we support character len
813: # TODO 2612 This may be more complex if we support character len


No description provided.