Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 8d37051

Browse files
authored
Merge branch 'master' into great-exportations
2 parents 293f178 + 5a7d002 commit 8d37051

36 files changed

Lines changed: 327 additions & 306 deletions

File tree

.github/workflows/haskell.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,16 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
ghc: ["8.10"]
18-
cabal: ["3.2"]
17+
ghc: ["8.10", "9.2"]
1918

2019
steps:
2120
- uses: actions/checkout@v2
2221
if: github.event.action == 'opened' || github.event.action == 'synchronize' || github.event.ref == 'refs/heads/master'
2322

24-
- uses: haskell/actions/setup@v1.2.2
23+
- uses: haskell/actions/setup@v1
2524
name: Setup Haskell
2625
with:
2726
ghc-version: ${{ matrix.ghc }}
28-
cabal-version: ${{ matrix.cabal }}
2927

3028
- uses: actions/cache@v1
3129
id: cache-cabal
@@ -47,7 +45,7 @@ jobs:
4745
- name: Configure project
4846
run: |
4947
cabal v2-update
50-
cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-benchmarks --enable-tests --write-ghc-environment-files=always -j2
48+
cabal v2-configure --project-file=cabal.project.ci --disable-optimization --enable-tests --write-ghc-environment-files=always -j2
5149
5250
- name: Restore from cache
5351
run: ./cabal-cache sync-from-archive --threads=2 --archive-uri=dist-cache || true
@@ -56,7 +54,7 @@ jobs:
5654
run: |
5755
cabal v2-build --project-file=cabal.project.ci semantic:exe:semantic
5856
cabal v2-run --project-file=cabal.project.ci semantic:test
59-
cabal v2-run --project-file=cabal.project.ci semantic-tags:test
57+
cabal v2-build --project-file=cabal.project.ci semantic-analysis
6058
cabal v2-run --project-file=cabal.project.ci semantic-codeql:test
6159
cabal v2-run --project-file=cabal.project.ci semantic-go:test
6260
cabal v2-run --project-file=cabal.project.ci semantic-java:test
@@ -65,6 +63,7 @@ jobs:
6563
# cabal v2-run --project-file=cabal.project.ci semantic-python:test:compiling
6664
# cabal v2-run --project-file=cabal.project.ci semantic-python:test:graphing
6765
cabal v2-run --project-file=cabal.project.ci semantic-ruby:test
66+
cabal v2-run --project-file=cabal.project.ci semantic-tags:test
6867
cabal v2-run --project-file=cabal.project.ci semantic-tsx:test
6968
cabal v2-run --project-file=cabal.project.ci semantic-typescript:test
7069
cabal v2-run --project-file=cabal.project.ci semantic-source:test

.hie-bios.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

.hie-dispatch.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

hie.yaml

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
11
cradle:
2-
bios:
3-
program: ".hie-dispatch.sh"
4-
dependency-program: script/ghci-flags-dependencies
2+
cabal:
3+
- path: "semantic"
4+
component: "lib:semantic"
5+
- path: "semantic-analysis"
6+
component: "lib:semantic-analysis"
7+
- path: "semantic-ast"
8+
component: "lib:semantic-ast"
9+
- path: "semantic-codeql"
10+
component: "lib:semantic-codeql"
11+
- path: "semantic-go"
12+
component: "lib:semantic-go"
13+
- path: "semantic-java"
14+
component: "lib:semantic-java"
15+
- path: "semantic-json"
16+
component: "lib:semantic-json"
17+
- path: "semantic-parse"
18+
component: "lib:semantic-parse"
19+
- path: "semantic-php"
20+
component: "lib:semantic-php"
21+
- path: "semantic-python"
22+
component: "lib:semantic-python"
23+
- path: "semantic-ruby"
24+
component: "lib:semantic-ruby"
25+
- path: "semantic-rust"
26+
component: "lib:semantic-rust"
27+
- path: "semantic-scope-graph"
28+
component: "lib:semantic-scope-graph"
29+
- path: "semantic-source"
30+
component: "lib:semantic-source"
31+
- path: "semantic-tags"
32+
component: "lib:semantic-tags"
33+
- path: "semantic-tsx"
34+
component: "lib:semantic-tsx"
35+
- path: "semantic-typescript"
36+
component: "lib:semantic-typescript"

script/ghci-flags

Lines changed: 79 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#!/usr/bin/env bash
2-
# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather ghcide will via configuration in hie.yaml.
2+
# Computes the flags for ghcide to pass to ghci. You probably won’t be running this yourself, but rather script/repl will.
33

44
set -e
55

66
cd "$(dirname "$0")/.."
77

88
ghc_version="$(ghc --numeric-version)"
99

10-
# recent hie-bios requires us to output to the file at $HIE_BIOS_OUTPUT, but older builds & script/repl don’t set that var, so we default it to stdout
11-
output_file="${HIE_BIOS_OUTPUT:-/dev/stdout}"
12-
1310
build_dir="dist-newstyle/build/x86_64-osx/ghc-$ghc_version"
1411
build_products_dir="$build_dir/build-repl"
1512

@@ -23,85 +20,81 @@ function add_autogen_includes {
2320

2421
cores=$(sysctl -n machdep.cpu.core_count || echo 4)
2522

26-
function flags {
27-
# disable optimizations for faster loading
28-
echo "-O0"
29-
# don’t load .ghci files (for ghcide)
30-
echo "-ignore-dot-ghci"
31-
32-
# use as many jobs as there are physical cores
33-
echo "-j$cores"
34-
35-
# where to put build products
36-
echo "-outputdir $build_products_dir"
37-
echo "-odir $build_products_dir"
38-
echo "-hidir $build_products_dir"
39-
echo "-stubdir $build_products_dir"
40-
41-
if [ -d "$build_dir/semantic-0.11.0.0/build/autogen" ]
42-
then add_autogen_includes "$build_dir/semantic-0.11.0.0/build/autogen"
43-
elif [ -d "$build_dir/semantic-0.11.0.0/noopt/build/autogen" ]
44-
then add_autogen_includes "$build_dir/semantic-0.11.0.0/noopt/build/autogen"
45-
fi
46-
47-
echo "-optP-Wno-macro-redefined"
48-
49-
echo "-DBAZEL_BUILD=0"
50-
51-
# .hs source dirs
52-
# TODO: would be nice to figure this out from cabal.project & the .cabal files
53-
echo "-isemantic/app"
54-
echo "-isemantic/src"
55-
echo "-isemantic/bench"
56-
echo "-isemantic/test"
57-
echo "-isemantic-analysis/src"
58-
echo "-isemantic-ast/src"
59-
echo "-isemantic-codeql/src"
60-
echo "-isemantic-codeql/test"
61-
echo "-isemantic-go/src"
62-
echo "-isemantic-java/src"
63-
echo "-isemantic-json/src"
64-
echo "-isemantic-json/test"
65-
echo "-isemantic-parse/src"
66-
echo "-isemantic-php/src"
67-
echo "-isemantic-proto/src"
68-
echo "-isemantic-python/src"
69-
echo "-isemantic-python/test"
70-
echo "-isemantic-ruby/src"
71-
echo "-isemantic-rust/src"
72-
echo "-isemantic-scope-graph/src"
73-
echo "-isemantic-tsx/src"
74-
echo "-isemantic-typescript/src"
75-
echo "-isemantic-tags/src"
76-
77-
# disable automatic selection of packages
78-
echo "-hide-all-packages"
79-
echo "-package proto-lens-jsonpb"
80-
81-
# run cabal and emit package flags from the environment file, removing comments & prefixing with -
82-
cabal v2-exec -v0 bash -- -c 'cat "$GHC_ENVIRONMENT"' | grep -v '^--' | sed -e 's/^/-/'
83-
84-
# default language extensions
85-
echo "-XHaskell2010"
86-
echo "-XStrictData"
87-
88-
# treat warnings as warnings
89-
echo "-Wwarn"
90-
91-
# default warning flags
92-
echo "-Weverything"
93-
echo "-Wno-all-missed-specialisations"
94-
echo "-Wno-implicit-prelude"
95-
echo "-Wno-missed-specialisations"
96-
echo "-Wno-missing-import-lists"
97-
echo "-Wno-missing-local-signatures"
98-
echo "-Wno-monomorphism-restriction"
99-
echo "-Wno-name-shadowing"
100-
echo "-Wno-safe"
101-
echo "-Wno-unsafe"
102-
[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-star-is-type" || true
103-
[[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-deriving-strategies" || true
104-
[[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages"
105-
}
106-
107-
flags > "$output_file"
23+
# disable optimizations for faster loading
24+
echo "-O0"
25+
# don’t load .ghci files (for ghcide)
26+
echo "-ignore-dot-ghci"
27+
28+
# use as many jobs as there are physical cores
29+
echo "-j$cores"
30+
31+
# where to put build products
32+
echo "-outputdir $build_products_dir"
33+
echo "-odir $build_products_dir"
34+
echo "-hidir $build_products_dir"
35+
echo "-stubdir $build_products_dir"
36+
37+
if [ -d "$build_dir/semantic-0.11.0.0/build/autogen" ]
38+
then add_autogen_includes "$build_dir/semantic-0.11.0.0/build/autogen"
39+
elif [ -d "$build_dir/semantic-0.11.0.0/noopt/build/autogen" ]
40+
then add_autogen_includes "$build_dir/semantic-0.11.0.0/noopt/build/autogen"
41+
fi
42+
43+
echo "-optP-Wno-macro-redefined"
44+
45+
echo "-DBAZEL_BUILD=0"
46+
47+
# .hs source dirs
48+
# TODO: would be nice to figure this out from cabal.project & the .cabal files
49+
echo "-isemantic/app"
50+
echo "-isemantic/src"
51+
echo "-isemantic/bench"
52+
echo "-isemantic/test"
53+
echo "-isemantic-analysis/src"
54+
echo "-isemantic-ast/src"
55+
echo "-isemantic-codeql/src"
56+
echo "-isemantic-codeql/test"
57+
echo "-isemantic-go/src"
58+
echo "-isemantic-java/src"
59+
echo "-isemantic-json/src"
60+
echo "-isemantic-json/test"
61+
echo "-isemantic-parse/src"
62+
echo "-isemantic-php/src"
63+
echo "-isemantic-proto/src"
64+
echo "-isemantic-python/src"
65+
echo "-isemantic-python/test"
66+
echo "-isemantic-ruby/src"
67+
echo "-isemantic-rust/src"
68+
echo "-isemantic-scope-graph/src"
69+
echo "-isemantic-tsx/src"
70+
echo "-isemantic-typescript/src"
71+
echo "-isemantic-tags/src"
72+
73+
# disable automatic selection of packages
74+
echo "-hide-all-packages"
75+
echo "-package proto-lens-jsonpb"
76+
77+
# run cabal and emit package flags from the environment file, removing comments & prefixing with -
78+
cabal v2-exec -v0 bash -- -c 'cat "$GHC_ENVIRONMENT"' | grep -v '^--' | sed -e 's/^/-/'
79+
80+
# default language extensions
81+
echo "-XHaskell2010"
82+
echo "-XStrictData"
83+
84+
# treat warnings as warnings
85+
echo "-Wwarn"
86+
87+
# default warning flags
88+
echo "-Weverything"
89+
echo "-Wno-all-missed-specialisations"
90+
echo "-Wno-implicit-prelude"
91+
echo "-Wno-missed-specialisations"
92+
echo "-Wno-missing-import-lists"
93+
echo "-Wno-missing-local-signatures"
94+
echo "-Wno-monomorphism-restriction"
95+
echo "-Wno-name-shadowing"
96+
echo "-Wno-safe"
97+
echo "-Wno-unsafe"
98+
[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-star-is-type" || true
99+
[[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-deriving-strategies" || true
100+
[[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages"

script/ghci-flags-dependencies

Lines changed: 0 additions & 21 deletions
This file was deleted.

semantic-ast/semantic-ast.cabal

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ common haskell
3838
ghc-options:
3939
-Wno-missing-safe-haskell-mode
4040
-Wno-prepositive-qualified-module
41+
if (impl(ghc >= 9.2))
42+
ghc-options:
43+
-Wno-missing-kind-signatures
4144
cpp-options:
4245
-DBAZEL_BUILD=0
4346

@@ -61,11 +64,11 @@ library
6164
-- other-modules:
6265
-- other-extensions:
6366
build-depends:
64-
, aeson ^>= 1.4.2.0
65-
, attoparsec ^>= 0.13.2.2
67+
, aeson >= 1.4.2.0 && < 3
68+
, attoparsec >= 0.13.2.2 && < 0.15
6669
, base >= 4.13 && < 5
67-
, bytestring ^>= 0.10.9
68-
, containers >= 0.6.0.1
70+
, bytestring >= 0.10.8.2 && < 0.13
71+
, containers ^>= 0.6.2
6972
, directory ^>= 1.3.3.2
7073
, filepath ^>= 1.4.1
7174
, fused-effects ^>= 1.1
@@ -74,7 +77,7 @@ library
7477
, semantic-source ^>= 0.1.0.1
7578
, tasty ^>= 1.2.3
7679
, tasty-hunit ^>= 0.10.0.2
77-
, template-haskell >= 2.15 && < 2.17
80+
, template-haskell >= 2.15 && < 2.19
7881
, text ^>= 1.2.3.1
7982
, tree-sitter ^>= 0.9.0.0
8083
, unordered-containers ^>= 0.2.10

semantic-ast/src/AST/GenerateSyntax.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
{-# LANGUAGE StandaloneDeriving #-}
2-
{-# LANGUAGE RankNTypes #-}
31
{-# LANGUAGE DataKinds #-}
42
{-# LANGUAGE DeriveAnyClass #-}
53
{-# LANGUAGE DeriveGeneric #-}
64
{-# LANGUAGE LambdaCase #-}
5+
{-# LANGUAGE RankNTypes #-}
6+
{-# LANGUAGE StandaloneDeriving #-}
77
{-# LANGUAGE TemplateHaskell #-}
88
{-# LANGUAGE TypeApplications #-}
99
module AST.GenerateSyntax
@@ -12,7 +12,8 @@ module AST.GenerateSyntax
1212
, astDeclarationsIO
1313
) where
1414

15-
import AST.Deserialize (Children (..), Datatype (..), DatatypeName (..), Field (..), Multiple (..), Named (..), Required (..), Type (..))
15+
import AST.Deserialize
16+
(Children (..), Datatype (..), DatatypeName (..), Field (..), Multiple (..), Named (..), Required (..), Type (..))
1617
import qualified AST.Parse as Parse
1718
import AST.Token
1819
import AST.Traversable1.Class
@@ -144,7 +145,7 @@ symbolMatchingInstance allSymbols name named (DatatypeName str) = do
144145
let tsSymbols = elemIndices (str, named) allSymbols
145146
names = intercalate ", " $ fmap (debugPrefix . (!!) allSymbols) tsSymbols
146147
[d|instance TS.SymbolMatching $(conT name) where
147-
matchedSymbols _ = tsSymbols
148+
matchedSymbols _ = $(lift tsSymbols)
148149
showFailure _ node = "expected " <> $(litE (stringL names))
149150
<> " but got " <> if nodeSymbol node == 65535 then "ERROR" else genericIndex debugSymbolNames (nodeSymbol node)
150151
<> " [" <> show r1 <> ", " <> show c1 <> "] -"

0 commit comments

Comments
 (0)