Skip to content

Commit 1c6ca93

Browse files
committed
Merge branch 'main' into legacyFreeForm
2 parents cff4818 + a5c580d commit 1c6ca93

File tree

10 files changed

+81
-50
lines changed

10 files changed

+81
-50
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121

2222
# relative paths are relative to the project directory
2323
- name: Cache Stack build artifacts (user + project)
24-
uses: actions/cache@v2
24+
uses: actions/cache@v4
2525
with:
2626
path: |
2727
~/.stack
@@ -81,15 +81,15 @@ jobs:
8181
8282
- name: Setup Haskell build environment
8383
id: setup-haskell-build-env
84-
uses: haskell/actions/setup@v2
84+
uses: haskell-actions/setup@v2
8585
with:
8686
ghc-version: ${{ matrix.ghc }}
87-
cabal-version: ${{ matrix.cabal }}
87+
cabal-version: 'latest'
8888

89-
- run: cabal freeze
89+
- run: cabal freeze --enable-tests
9090

9191
- name: Cache Cabal build artifacts
92-
uses: actions/cache@v2
92+
uses: actions/cache@v4
9393
with:
9494
path: |
9595
${{ steps.setup-haskell-build-env.outputs.cabal-store }}
@@ -99,7 +99,7 @@ jobs:
9999
${{ runner.os }}-cabal-${{ matrix.ghc }}
100100
101101
- name: Test
102-
run: cabal test --test-show-details=streaming
102+
run: cabal test --enable-tests --test-show-details=streaming
103103
env:
104104
HSPEC_OPTIONS: --color
105105

@@ -118,15 +118,15 @@ jobs:
118118

119119
- name: Setup Haskell build environment
120120
id: setup-haskell-build-env
121-
uses: haskell/actions/setup@v2
121+
uses: haskell-actions/setup@v2
122122
with:
123123
ghc-version: ${{ matrix.ghc }}
124-
cabal-version: ${{ matrix.cabal }}
124+
cabal-version: 'latest'
125125

126-
- run: cabal freeze
126+
- run: cabal freeze --enable-tests
127127

128128
- name: Cache Cabal build artifacts
129-
uses: actions/cache@v2
129+
uses: actions/cache@v4
130130
with:
131131
path: |
132132
${{ steps.setup-haskell-build-env.outputs.cabal-store }}
@@ -139,7 +139,7 @@ jobs:
139139
run: cabal install
140140

141141
- name: Test
142-
run: cabal test --test-show-details=streaming
142+
run: cabal test --enable-tests --test-show-details=streaming
143143
env:
144144
HSPEC_OPTIONS: --color
145145

@@ -166,15 +166,15 @@ jobs:
166166

167167
- name: Setup Haskell build environment
168168
id: setup-haskell-build-env
169-
uses: haskell/actions/setup@v2
169+
uses: haskell-actions/setup@v2
170170
with:
171171
ghc-version: ${{ matrix.ghc }}
172-
cabal-version: ${{ matrix.cabal }}
172+
cabal-version: 'latest'
173173

174-
- run: cabal freeze
174+
- run: cabal freeze --enable-tests
175175

176176
- name: Cache Cabal build artifacts
177-
uses: actions/cache@v2
177+
uses: actions/cache@v4
178178
with:
179179
path: |
180180
${{ steps.setup-haskell-build-env.outputs.cabal-store }}
@@ -187,7 +187,7 @@ jobs:
187187
run: cabal install
188188

189189
- name: Test
190-
run: cabal test --test-show-details=streaming
190+
run: cabal test --enable-tests --test-show-details=streaming
191191
env:
192192
HSPEC_OPTIONS: --color
193193

@@ -197,3 +197,10 @@ jobs:
197197
path: "C:/cabal/bin/${{ env.EXE_NAME }}.exe"
198198
name: ${{ env.EXE_NAME }}-windows-ghc-${{ matrix.ghc }}-cabal-${{ github.sha }}.exe
199199
if-no-files-found: error
200+
201+
- name: Upload cabal build logs
202+
if: failure()
203+
uses: actions/upload-artifact@v4
204+
with:
205+
name: cabal-build-logs
206+
path: C:\cabal\logs\

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### 0.16.8
2+
* Package build support up to GHC 9.12
3+
* Fixed pretty printing of array semantic types
4+
15
### 0.16.7
26
* Added mention of Fortran 2003 version support in the help message
37
* Improved parsing of `allocate` statements

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
[![DOI](https://joss.theoj.org/papers/10.21105/joss.07571/status.svg)](https://doi.org/10.21105/joss.07571)
44

55

6-
fortran-src is an open-source Haskell library and command-line application for the lexing, parsing, and static analysis of Fortran source code. It provides an interface to build other tools, e.g., for static analysis, automated refactoring, verification, and compilation. The following
6+
fortran-src is an open-source Haskell library and command-line application for the lexing, parsing, and static analysis of Fortran source code. It provides an interface to build other tools, e.g., for static analysis, automated refactoring, verification, and compilation.
7+
8+
> To cite this work, or for a high-level overview, please take a look at our paper: [Contrastin et al., (2025). fortran-src: Fortran static analysis infrastructure. Journal of Open Source Software, 10(106), 7571, https://doi.org/10.21105/joss.07571](https://joss.theoj.org/papers/10.21105/joss.07571)
9+
10+
11+
The following
712
Fortran standards are covered:
813

914
* FORTRAN 66 (ANSI X3.9-1966)
@@ -96,7 +101,7 @@ via the package `libgmp-dev`.
96101
Haskell library dependencies are listed in `package.yaml`. fortran-src supports
97102
building with Stack or Cabal.
98103

99-
fortran-src supports **GHC 9.0 through GHC 9.4**. We regularly test at least the
104+
fortran-src supports **GHC 9.0 through GHC 9.12** (as of Aug 2025). We regularly test at least the
100105
minimum and maximum supported GHCs. Releases prior to/newer than those may have
101106
issues. We welcome fixes that would let us support a wider range of compilers.
102107

app/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ programName :: String
5151
programName = "fortran-src"
5252

5353
showVersion :: String
54-
showVersion = "0.16.7"
54+
showVersion = "0.16.8"
5555

5656
main :: IO ()
5757
main = do

fortran-src.cabal

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
cabal-version: 1.12
22

3-
-- This file has been generated from package.yaml by hpack version 0.38.0.
3+
-- This file has been generated from package.yaml by hpack version 0.38.1.
44
--
55
-- see: https://github.com/sol/hpack
66

77
name: fortran-src
8-
version: 0.16.7
8+
version: 0.16.8
99
synopsis: Parsers and analyses for Fortran standards 66, 77, 90, 95 and 2003 (partial).
1010
description: Provides lexing, parsing, and basic analyses of Fortran code covering standards: FORTRAN 66, FORTRAN 77, Fortran 90, Fortran 95, Fortran 2003 (partial) and some legacy extensions. Includes data flow and basic block analysis, a renamer, and type analysis. For example usage, see the @<https://hackage.haskell.org/package/camfort CamFort>@ project, which uses fortran-src as its front end.
1111
category: Language
@@ -20,7 +20,7 @@ license: Apache-2.0
2020
license-file: LICENSE
2121
build-type: Simple
2222
tested-with:
23-
GHC >= 9.0
23+
GHC == 9.0, GHC == 9.2, GHC == 9.4, GHC == 9.6, GHC == 9.8, GHC == 9.10, GHC == 9.12
2424
extra-source-files:
2525
README.md
2626
CHANGELOG.md
@@ -193,7 +193,7 @@ library
193193
build-depends:
194194
GenericPretty >=1.2.2 && <2
195195
, array ==0.5.*
196-
, base >=4.6 && <5
196+
, base >=4.6 && <4.22
197197
, binary >=0.8.3.0 && <0.11
198198
, bytestring >=0.10 && <0.13
199199
, containers >=0.5 && <0.7
@@ -205,9 +205,9 @@ library
205205
, mtl >=2.2 && <3
206206
, pretty >=1.1 && <2
207207
, process >=1.2.0.0
208-
, singletons ==3.0.*
209-
, singletons-base >=3.0 && <3.4
210-
, singletons-th >=3.0 && <3.4
208+
, singletons >=3.0 && <3.6
209+
, singletons-base >=3.0 && <3.6
210+
, singletons-th >=3.0 && <3.6
211211
, temporary >=1.2 && <1.4
212212
, text >=1.2 && <2.2
213213
, uniplate >=1.6 && <2
@@ -256,7 +256,7 @@ executable fortran-src
256256
build-depends:
257257
GenericPretty >=1.2.2 && <2
258258
, array ==0.5.*
259-
, base >=4.6 && <5
259+
, base >=4.6 && <4.22
260260
, binary >=0.8.3.0 && <0.11
261261
, bytestring >=0.10 && <0.13
262262
, containers >=0.5 && <0.7
@@ -269,9 +269,9 @@ executable fortran-src
269269
, mtl >=2.2 && <3
270270
, pretty >=1.1 && <2
271271
, process >=1.2.0.0
272-
, singletons ==3.0.*
273-
, singletons-base >=3.0 && <3.4
274-
, singletons-th >=3.0 && <3.4
272+
, singletons >=3.0 && <3.6
273+
, singletons-base >=3.0 && <3.6
274+
, singletons-th >=3.0 && <3.6
275275
, temporary >=1.2 && <1.4
276276
, text >=1.2 && <2.2
277277
, uniplate >=1.6 && <2
@@ -354,7 +354,7 @@ test-suite spec
354354
GenericPretty >=1.2.2 && <2
355355
, QuickCheck >=2.10 && <2.15
356356
, array ==0.5.*
357-
, base >=4.6 && <5
357+
, base >=4.6 && <4.22
358358
, binary >=0.8.3.0 && <0.11
359359
, bytestring >=0.10 && <0.13
360360
, containers >=0.5 && <0.7
@@ -368,9 +368,9 @@ test-suite spec
368368
, mtl >=2.2 && <3
369369
, pretty >=1.1 && <2
370370
, process >=1.2.0.0
371-
, singletons ==3.0.*
372-
, singletons-base >=3.0 && <3.4
373-
, singletons-th >=3.0 && <3.4
371+
, singletons >=3.0 && <3.6
372+
, singletons-base >=3.0 && <3.6
373+
, singletons-th >=3.0 && <3.6
374374
, temporary >=1.2 && <1.4
375375
, text >=1.2 && <2.2
376376
, uniplate >=1.6 && <2

package.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: fortran-src
2-
version: '0.16.7'
2+
version: '0.16.8'
33
synopsis: Parsers and analyses for Fortran standards 66, 77, 90, 95 and 2003 (partial).
44
description: >-
55
Provides lexing, parsing, and basic analyses of Fortran code covering
@@ -8,7 +8,7 @@ description: >-
88
analysis, a renamer, and type analysis. For example usage, see the
99
@<https://hackage.haskell.org/package/camfort CamFort>@ project, which uses
1010
fortran-src as its front end.
11-
tested-with: GHC >= 9.0
11+
tested-with: GHC == 9.0, GHC == 9.2, GHC == 9.4, GHC == 9.6, GHC == 9.8, GHC == 9.10, GHC == 9.12
1212
github: camfort/fortran-src
1313
bug-reports: https://github.com/camfort/fortran-src/issues
1414
author: [Mistral Contrastin, Matthew Danish, Dominic Orchard, Andrew Rice]
@@ -80,7 +80,7 @@ ghc-options:
8080
#- -Werror # appears bad to do in distribution, can be useful for development
8181

8282
dependencies:
83-
- base >=4.6 && <5
83+
- base >=4.6 && <4.22
8484
- mtl >=2.2 && <3
8585
- array >=0.5 && <0.6
8686
- uniplate >=1.6 && <2
@@ -99,11 +99,11 @@ dependencies:
9999
- either ^>=5.0.1.1
100100
- process >= 1.2.0.0
101101

102-
- singletons >= 3.0 && < 3.1
102+
- singletons >= 3.0 && < 3.6
103103

104-
# 3.0 = GHC 9.0, 3.1 = GHC 9.2, 3.1.1 = GHC 9.4, 3.2 = GHC 9.6, 3.3 = GHC 9.8
105-
- singletons-th >= 3.0 && < 3.4
106-
- singletons-base >= 3.0 && < 3.4
104+
# 3.0 = GHC 9.0, 3.1 = GHC 9.2, 3.1.1 = GHC 9.4, 3.2 = GHC 9.6, 3.3 = GHC 9.8, 3.5 = GHC 9.10
105+
- singletons-th >= 3.0 && < 3.6
106+
- singletons-base >= 3.0 && < 3.6
107107

108108
library:
109109
source-dirs: src

src/Language/Fortran/Analysis/SemanticTypes.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ instance Pretty SemType where
6666
TLogical k -> "logical"<>pd k
6767
TByte k -> "byte"<>pd k
6868
TCharacter _ _ -> "character(TODO)"
69-
TArray st dims -> pprint' v st <> pprint' v dims
69+
TArray st dims -> pprint' v st <> pdims v dims
7070
TCustom str -> pprint' v (TypeCustom str)
7171
| otherwise = \case
7272
TInteger k -> "integer"<>ad k
@@ -75,11 +75,13 @@ instance Pretty SemType where
7575
TLogical k -> "logical"<>ad k
7676
TByte k -> "byte"<>ad k
7777
TCharacter _ _ -> "character*TODO"
78-
TArray st dims -> pprint' v st <> pprint' v dims
78+
TArray st dims -> pprint' v st <> pdims v dims
7979
TCustom str -> pprint' v (TypeCustom str)
8080
where
8181
pd = Pretty.parens . doc
8282
ad k = doc '*' <> doc k
83+
pdims v dims = maybe Pretty.empty (pprint' v) (dimsTraverse dims)
84+
8385

8486
-- | Convert 'Dimensions' data type to its previous type synonym
8587
-- @(Maybe [(Int, Int)])@.

stack.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
resolver: lts-20.01
1+
resolver: lts-23.27
22
packages:
3-
- '.'
3+
- '.'
44
save-hackage-creds: false

stack.yaml.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# This file was autogenerated by Stack.
22
# You should not edit this file by hand.
33
# For more information, please see the documentation at:
4-
# https://docs.haskellstack.org/en/stable/lock_files
4+
# https://docs.haskellstack.org/en/stable/topics/lock_files
55

66
packages: []
77
snapshots:
88
- completed:
9-
sha256: b73b2b116143aea728c70e65c3239188998bac5bc3be56465813dacd74215dc5
10-
size: 648424
11-
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/20/1.yaml
12-
original: lts-20.1
9+
sha256: 069c8189232279d04bd107557d3a62132c04ae5ce3c710649e6b40f67f10b9d5
10+
size: 684285
11+
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/27.yaml
12+
original: lts-23.27

test/Language/Fortran/Analysis/SemanticTypesSpec.hs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
{-# LANGUAGE OverloadedLists #-}
2+
{-# LANGUAGE OverloadedStrings #-}
3+
14
module Language.Fortran.Analysis.SemanticTypesSpec where
25

36
import Test.Hspec
@@ -7,6 +10,10 @@ import Language.Fortran.Analysis.SemanticTypes
710
import Language.Fortran.AST
811
import Language.Fortran.Version
912

13+
import Language.Fortran.PrettyPrint
14+
import Text.PrettyPrint hiding ((<>))
15+
import Text.PrettyPrint.GenericPretty
16+
1017
spec :: Spec
1118
spec = do
1219
describe "Semantic types" $ do
@@ -29,3 +36,9 @@ spec = do
2936
let semtype = TCharacter CharLenStar 1
3037
typespec = TypeSpec () u TypeCharacter (Just (Selector () u (Just (ExpValue () u ValStar)) Nothing))
3138
in recoverSemTypeTypeSpec () u Fortran90 semtype `shouldBe` typespec
39+
40+
it "prints semantic type with dimensions" $ do
41+
let dims = DimsExplicitShape ( [ Dim (Just 1) (Just 3), Dim (Just 1) (Just 4) ] )
42+
let semtype = TArray (TReal 8) dims
43+
pprint Fortran90 semtype Nothing `shouldBe` "real(8)(1:3, 1:4)"
44+

0 commit comments

Comments
 (0)