Skip to content

Commit

Permalink
#2642 Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienRemy committed Nov 29, 2024
1 parent 1cd37e4 commit 0719559
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
4 changes: 1 addition & 3 deletions src/psyclone/domain/lfric/kernel/lfric_kernel_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -706,9 +706,7 @@ def create_from_psyir(symbol):
# This will be removed when the metadata is extracted from the PSyIR
# itself.
if isinstance(datatype, StructureType):
type_declaration = FortranWriter().gen_typedecl(symbol)
type_declaration = type_declaration.replace(", public", "")
type_declaration = type_declaration.replace(", private", "")
type_declaration = FortranWriter().gen_typedecl(symbol, False)
return LFRicKernelMetadata.create_from_fortran_string(
type_declaration)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,19 +1148,12 @@ def test_get_procedure_name_error(fortran_reader):
structure_type = datatype_symbol.datatype
assert isinstance(structure_type, StructureType)
assert len(structure_type.procedure_components) == 0
# metadata = LFRicKernelMetadata()
# reader = FortranStringReader(datatype.declaration)
# spec_part = Fortran2003.Derived_Type_Def(reader)
# with pytest.raises(ParseError) as info:
# metadata._get_procedure_name(spec_part)
# assert "Expecting a type-bound procedure, but found" in str(info.value)

kernel_psyir = fortran_reader.psyir_from_source(PROGRAM)
datatype_symbol = kernel_psyir.children[0].symbol_table.lookup(
"testkern_type")
datatype = datatype_symbol.datatype
metadata = LFRicKernelMetadata()
# reader = FortranStringReader(datatype.declaration)
assert isinstance(datatype, StructureType)
type_declaration = FortranWriter().gen_typedecl(datatype_symbol)
reader = FortranStringReader(type_declaration)
Expand All @@ -1178,7 +1171,6 @@ def test_get_procedure_name_error(fortran_reader):
"testkern_type")
datatype = datatype_symbol.datatype
metadata = LFRicKernelMetadata()
# reader = FortranStringReader(datatype.declaration)
assert isinstance(datatype, StructureType)
type_declaration = FortranWriter().gen_typedecl(datatype_symbol)
reader = FortranStringReader(type_declaration)
Expand All @@ -1201,12 +1193,9 @@ def test_get_procedure_name(fortran_reader):
"testkern_type")
datatype = datatype_symbol.datatype
metadata = LFRicKernelMetadata()
# reader = FortranStringReader(datatype.declaration)

assert isinstance(datatype, StructureType)
type_declaration = FortranWriter().gen_typedecl(datatype_symbol)
reader = FortranStringReader(type_declaration)

spec_part = Fortran2003.Derived_Type_Def(reader)
assert metadata._get_procedure_name(spec_part) == \
"testkern_code"
Expand Down
4 changes: 0 additions & 4 deletions src/psyclone/tests/psyad/domain/lfric/test_lfric_adjoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,6 @@ def test_generate_lfric_adjoint_multi_precision(
assert isinstance(datatype, StructureType)
datatype.procedure_components.clear()
# Remove procedure metadata
# new_declaration = (datatype.declaration.
# replace("PROCEDURE, NOPASS :: kern_code", "").
# replace("CONTAINS", ""))
# datatype._declaration = new_declaration
ad_psyir = generate_lfric_adjoint(psyir, ["field_1_w0", "field_2_w0"])
result = fortran_writer(ad_psyir)
# Check that the metadata type name is updated.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,6 @@ def test_derived_type_contains():
assert isinstance(sym.datatype, StructureType)
assert len(sym.datatype.components) == 2
assert len(sym.datatype.procedure_components) == 1
# assert sym.datatype.declaration == '''\
# TYPE :: my_type
# INTEGER :: flag
# REAL, DIMENSION(3) :: posn
# CONTAINS
# PROCEDURE :: init => obesdv_setup
# END TYPE my_type'''


@pytest.mark.usefixtures("f2008_parser")
Expand Down

0 comments on commit 0719559

Please sign in to comment.