provide.f90 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ! The program units in this file consist of a
  2. ! module/submodule tree represented by the following
  3. ! graph:
  4. !
  5. ! parent
  6. ! |
  7. ! / \
  8. ! / \
  9. ! child sibling
  10. ! |
  11. ! grandchild
  12. !
  13. ! where the parent node is a module and all other
  14. ! nodes are submodules.
  15. module parent
  16. implicit none
  17. interface
  18. ! Test Fortran 2008 "module function" syntax
  19. module function child_function() result(child_stuff)
  20. logical :: child_stuff
  21. end function
  22. ! Test Fortran 2008 "module subroutine" syntax
  23. module subroutine grandchild_subroutine()
  24. end subroutine
  25. end interface
  26. end module parent
  27. ! Test the notation for a 1st-generation direct
  28. ! descendant of a parent module
  29. submodule ( parent ) child
  30. implicit none
  31. contains
  32. module function child_function() result(child_stuff)
  33. logical :: child_stuff
  34. child_stuff=.true.
  35. end function
  36. end submodule child
  37. ! Empty submodule for checking disambiguation of
  38. ! nodes at the same vertical level in the tree
  39. submodule ( parent ) sibling
  40. end submodule sibling
  41. ! Test the notation for an Nth-generation descendant
  42. ! for N>1, which necessitates the colon.
  43. submodule ( parent : child ) grandchild
  44. contains
  45. module subroutine grandchild_subroutine()
  46. print *,"Test passed."
  47. end subroutine
  48. end submodule grandchild