Fortran-FOSS-Programmers / Fortran-FOSS-Programmers/ford

Problems with public methods in derived type

Open
#508 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
458
Forks
138
PR merge metrics
No merged PRs in 30d

Description

Have problems with how public methods of a derived type are displayed in FORD-generated doc.

Code correctness verified with gfortran.
Note: workarounds attempted are in Fortran code comments.

```
!> mod_external module
module mod_external

implicit none

private

public external_class_t

! public :: output_int_ext
! public :: output_real_generic_ext
! public :: output_complex_generic_ext

!> type definition in external_class_t class
type external_class_t

private

contains

!> procedure declaration inside external_class_t class
procedure :: output_int_ext
! procedure, public :: output_int_ext

generic :: output_generic_ext => output_real_generic_ext, &
output_complex_generic_ext
procedure :: output_real_generic_ext
procedure :: output_complex_generic_ext

end type external_class_t

! public :: output_int_ext
! public :: output_real_generic_ext
! public :: output_complex_generic_ext

contains

!> subroutine output_int method of external_class_t in mod_external module
subroutine output_int_ext(this, an_int)

implicit none

class(external_class_t), intent(in) :: this
integer, intent(in) :: an_int !! dummy variable declaration mod_external

write (*,*) "an_int = ", an_int

end subroutine output_int_ext

!> subroutine output_real_generic_ext method of external_class_t in mod_external module
subroutine output_real_generic_ext(this, a_real)

implicit none

class(external_class_t), intent(in) :: this
real, intent(in) :: a_real !! dummy variable declaration mod_external

write (*,*) "a_real = ", a_real

end subroutine output_real_generic_ext

!> subroutine output_complex_generic_ext method of external_class_t in mod_external module
subroutine output_complex_generic_ext(this, a_complex)

implicit none

class(external_class_t), intent(in) :: this
complex, intent(in) :: a_complex !! dummy variable declaration mod_external

write (*,*) "a_complex = ", a_complex

end subroutine output_complex_generic_ext

end module mod_external
```
### Problems
- the public methods (public by default) are not showing up
- in Procedures section of main webpage
- on Procedures webpage
- they are showing up on *Modules/mod_external* (but not in the Subroutines section) and *Derived Types/external_class_t* webpages
- but on *external_class_t* webpage, the *output_int_ext* method shows up as "header" public and "body" private
- same is true for the generic and non-generic entries for *output_real_generic_ext* and *output_complex_generic_ext* methods

### Workaround
- tried adding *public* attribute to method declaration in derived type contains sections
- e.g., procedure, public :: output_int_ext
- doesn't help
- added public statements for the methods in the specification part of the module (not inside derived type)
- i.e.,
```
public :: output_int_ext
public :: output_real_generic_ext
public :: output_complex_generic_ext
```
- WORKED
- solves all above problems, but AFAIK shouldn't have to do this

(FORD version 6.2.4)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.