From 046af65a0bba522ea12e82c2e2427e2a9452dc3c Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Thu, 12 Sep 2024 12:14:02 +0000 Subject: [PATCH] Transformation: Fix for internal routine extraction with literal kinds --- loki/transformations/extract/internal.py | 2 +- loki/transformations/extract/tests/test_extract_internal.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/loki/transformations/extract/internal.py b/loki/transformations/extract/internal.py index 54bf48649..55c34f5dd 100644 --- a/loki/transformations/extract/internal.py +++ b/loki/transformations/extract/internal.py @@ -156,7 +156,7 @@ def extract_internal_procedure(procedure, name): # Produce kinds appearing in `vars_to_resolve` or in `inner.spec` that need to be resolved # from imports of `procedure`. kind_imports_to_add = tuple(v.type.kind for v in vars_to_resolve + inner_spec_vars \ - if v.type.kind and v.type.kind.scope is procedure) + if v.type.kind and hasattr(v.type.kind, 'scope') and v.type.kind.scope is procedure) # Produce all imports to add. # Here the imports are also tidied to only import what is strictly necessary, and with single diff --git a/loki/transformations/extract/tests/test_extract_internal.py b/loki/transformations/extract/tests/test_extract_internal.py index 6bbd1fd04..832275d18 100644 --- a/loki/transformations/extract/tests/test_extract_internal.py +++ b/loki/transformations/extract/tests/test_extract_internal.py @@ -336,7 +336,7 @@ def test_extract_internal_procedures_kind_resolution(frontend): contains subroutine inner() integer(kind = jpim) :: y - integer :: z + integer(kind=8) :: z z = y end subroutine inner end subroutine outer