1
1
mirror of https://github.com/github/semantic.git synced 2024-11-23 08:27:56 +03:00

Merge pull request #618 from github/eight-dot-ten-patrickt

Update to GHC v8.10.1
This commit is contained in:
Rick Winfrey 2020-09-02 12:30:28 -07:00 committed by GitHub
commit a7001c1828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
50 changed files with 528 additions and 589 deletions

View File

@ -24,7 +24,11 @@
:seti -Wno-safe
:seti -Wno-unsafe
:seti -Wno-star-is-type
-- 8.8+
:seti -Wno-missing-deriving-strategies
-- 8.10+
:seti -Wno-missing-safe-haskell-mode
:seti -Wno-prepositive-qualified-module
-- Turn on some language extensions you use a lot
:seti -XFlexibleContexts -XOverloadedStrings -XTypeApplications
@ -44,5 +48,6 @@
-- Better typed holes
:set -funclutter-valid-hole-fits -fabstract-refinement-hole-fits -frefinement-level-hole-fits=2
-- This usually impairs understanding
-- We have this one on in the project but not in the REPL to reduce noise
:seti -Wno-type-defaults
:set -Wno-unused-packages

View File

@ -3,10 +3,10 @@ name: Bazel CI
on:
# Trigger the workflow on push or pull request,
# but only for the master branch
push:
branches:
- master
pull_request:
# push:
# branches:
# - master
# pull_request: {}
jobs:
build:
@ -40,5 +40,6 @@ jobs:
- name: Build & test
run: |
bin/bazel test --config=ci --test_tag_filters=language-test //...
bin/bazel test --config=ci //semantic-source //semantic:spec
bin/bazel clean
bin/bazel test --sandbox_debug --config=ci --test_tag_filters=language-test //...
bin/bazel test --sandbox_debug --config=ci //semantic-source //semantic:spec

View File

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ghc: ["8.8.3"]
ghc: ["8.8.3", "8.10.1"]
cabal: ["3.2.0.0"]
steps:
@ -69,7 +69,6 @@ jobs:
cabal v2-run --project-file=cabal.project.ci semantic-tsx:test
cabal v2-run --project-file=cabal.project.ci semantic-typescript:test
cabal v2-run --project-file=cabal.project.ci semantic-source:test
cabal v2-run --project-file=cabal.project.ci semantic-source:doctest -- semantic-source/src
- name: Write out cache
run: ./cabal-cache sync-to-archive --threads=2 --archive-uri=dist-cache

View File

@ -15,18 +15,11 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# an updated version.
#
# [1] https://github.com/tweag/rules_haskell/issues/1349
#
# http_archive(
# name = "rules_haskell",
# sha256 = "56a8e6337df8802f1e0e7d2b3d12d12d5d96c929c8daecccc5738a0f41d9c1e4",
# strip_prefix = "rules_haskell-0.12",
# urls = ["https://github.com/tweag/rules_haskell/archive/v0.12.tar.gz"],
# )
http_archive(
name = "rules_haskell",
sha256 = "78d017aa732b430c0681fff4514503af78a8d8c44df165e603a9433745b16e5e",
strip_prefix = "rules_haskell-abaec6502a4474f10b3c367fb5e90173ee0e349c",
urls = ["https://github.com/tweag/rules_haskell/archive/abaec6502a4474f10b3c367fb5e90173ee0e349c.tar.gz"],
sha256 = "5e8077ae243b4bcf7bb913dfd9b4335c3b4bd2554658c62db7b3eb5351c80d8e",
strip_prefix = "rules_haskell-aabeedc18f5e5db030ca1aa0c10a7dc14e4a4a55",
urls = ["https://github.com/tweag/rules_haskell/archive/aabeedc18f5e5db030ca1aa0c10a7dc14e4a4a55.tar.gz"],
)
load(
@ -45,7 +38,7 @@ load(
# Download a GHC binary distribution from haskell.org and register it as a toolchain.
rules_haskell_toolchains(
locale = "en_US.UTF-8",
version = "8.8.3",
version = "8.10.1",
)
# Enable GHC persistent worker mode, if that's your bag.
@ -75,6 +68,7 @@ stack_snapshot(
"async",
"attoparsec",
"base",
"base64-bytestring",
"bazel-runfiles",
"bifunctors",
"bytestring",
@ -100,7 +94,9 @@ stack_snapshot(
"hspec",
"hspec-core",
"hspec-expectations",
"proto-lens-jsonpb",
"lens",
"lingo",
"network",
"network-uri",
"optparse-applicative",
@ -112,7 +108,6 @@ stack_snapshot(
"prettyprinter-ansi-terminal",
"process",
"proto-lens",
"proto-lens-jsonpb",
"proto-lens-runtime",
"raw-strings-qq",
"recursion-schemes",
@ -243,15 +238,6 @@ tree_sitter_node_types_hackage(
version = "0.1.0.1",
)
# Download lingo (which has its own Bazel build instructions).
http_archive(
name = "lingo",
sha256 = "32a5e2d66e4620ff7004acab4802dc948b852ce26725012283a85d41af97275f",
strip_prefix = "lingo-haskell-6614b9afe1a519364491c170d6b06ff5cd96153a",
urls = ["https://github.com/tclem/lingo-haskell/archive/6614b9afe1a519364491c170d6b06ff5cd96153a.tar.gz"],
)
load("//:build/example_repos.bzl", "declare_example_repos")
declare_example_repos()

View File

@ -31,6 +31,9 @@ GHC_FLAGS = [
"-Wno-star-is-type",
"-Wno-missing-deriving-strategies",
"-DBAZEL_BUILD=1",
"-Wno-unused-packages",
"-Wno-prepositive-qualified-module",
"-Wno-missing-safe-haskell-mode",
] + select(
{
"//:release": RELEASE_GHC_FLAGS,
@ -126,7 +129,6 @@ def semantic_language_library(language, name, srcs, ts_package = "", nodetypes =
"@stackage//:fused-effects",
"@stackage//:fused-syntax",
"@stackage//:generic-lens",
"@stackage//:generic-monoid",
"@stackage//:hashable",
"@stackage//:lens",
"@stackage//:pathtype",

View File

@ -21,13 +21,6 @@ packages: semantic
semantic-tsx
semantic-typescript
-- Packages brought in from other repos instead of hackage
-- ATTENTION: remember to update cabal.project.ci when bumping SHAs here!
source-repository-package
type: git
location: https://github.com/tclem/proto-lens-jsonpb
tag: 5d40444be689bef1e12cbe38da0261283775ec64
source-repository-package
type: git
location: https://github.com/antitypical/fused-syntax.git

View File

@ -21,13 +21,6 @@ packages: semantic
semantic-tsx
semantic-typescript
-- Packages brought in from other repos instead of hackage
-- ATTENTION: remember to update cabal.project when bumping SHAs here!
source-repository-package
type: git
location: https://github.com/tclem/proto-lens-jsonpb
tag: 5d40444be689bef1e12cbe38da0261283775ec64
source-repository-package
type: git
location: https://github.com/antitypical/fused-syntax.git

View File

@ -46,6 +46,8 @@ function flags {
echo "-optP-Wno-macro-redefined"
echo "-DBAZEL_BUILD=0"
# .hs source dirs
# TODO: would be nice to figure this out from cabal.project & the .cabal files
echo "-isemantic/app"
@ -98,8 +100,9 @@ function flags {
echo "-Wno-name-shadowing"
echo "-Wno-safe"
echo "-Wno-unsafe"
[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] && echo "-Wno-star-is-type" || true
[[ "$ghc_version" = 8.8.* ]] && echo "-Wno-missing-deriving-strategies" || true
[[ "$ghc_version" = 8.6.* ]] || [[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-star-is-type" || true
[[ "$ghc_version" = 8.8.* ]] || [[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-deriving-strategies" || true
[[ "$ghc_version" = 8.10.* ]] && echo "-Wno-missing-safe-haskell-mode" && echo "-Wno-prepositive-qualified-module" && echo "-Wno-unused-packages"
}
flags > "$output_file"

View File

@ -35,6 +35,10 @@ common common
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
library
import: common
@ -63,19 +67,10 @@ library
, algebraic-graphs ^>= 0.3
, base >= 4.13 && < 5
, containers ^>= 0.6
, filepath
, fused-effects ^>= 1.1
, fused-effects-readline ^>= 0.1
, fused-syntax
, hashable
, haskeline ^>= 0.7.5
, hashable
, lingo ^>= 0.3.2.0
, pathtype ^>= 0.8.1
, prettyprinter >= 1.2 && < 2
, prettyprinter-ansi-terminal ^>= 1.1.1
, semantic-source ^>= 0.1.0
, semilattices
, terminal-size ^>= 0.3
, semantic-source ^>= 0.1.0.1
, text ^>= 1.2.3.1
, transformers ^>= 0.5

View File

@ -34,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -56,31 +60,24 @@ library
-- other-modules:
-- other-extensions:
build-depends: base ^>= 4.13
, aeson ^>= 1.4.2.0
, aeson-pretty ^>= 0.8.8
, bytestring ^>= 0.10.9
, containers >= 0.6.0.1
, directory ^>= 1.3.3.2
, filepath ^>= 1.4.1
, fused-effects ^>= 1.1
, tree-sitter ^>= 0.9.0.0
, semantic-source ^>= 0.1.0
, template-haskell ^>= 2.15
, bytestring ^>= 0.10.8.2
, optparse-applicative >= 0.14.3 && < 0.16
, pretty-simple ^>= 3.1.0.0
, tree-sitter-python ^>= 0.9.0.1
, text ^>= 1.2.3.1
, unordered-containers ^>= 0.2.10
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, Glob ^>= 0.10.0
, attoparsec ^>= 0.13.2.2
, text ^>= 1.2.3
, tasty ^>= 1.2.3
, tasty-hedgehog ^>= 1.0.0.1
, tasty-hunit ^>= 0.10.0.2
build-depends:
, aeson ^>= 1.4.2.0
, attoparsec ^>= 0.13.2.2
, base >= 4.13 && < 5
, bytestring ^>= 0.10.9
, containers >= 0.6.0.1
, directory ^>= 1.3.3.2
, filepath ^>= 1.4.1
, fused-effects ^>= 1.1
, Glob ^>= 0.10.0
, pathtype ^>= 0.8.1
, semantic-source ^>= 0.1.0.1
, tasty ^>= 1.2.3
, tasty-hunit ^>= 0.10.0.2
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3.1
, tree-sitter ^>= 0.9.0.0
, unordered-containers ^>= 0.2.10
hs-source-dirs: src
default-language: Haskell2010

View File

@ -18,7 +18,7 @@ import AST.Traversable1.Class
import qualified AST.Unmarshal as TS
import Data.Aeson hiding (String)
import Data.Foldable
import Data.List
import Data.List (elemIndices, genericIndex, intercalate)
import Data.List.NonEmpty (NonEmpty (..))
import Data.Text (Text)
import Foreign.C.String

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-ql ^>= 0.1.0.2
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,19 +49,27 @@ library
Language.CodeQL.Grammar
Language.CodeQL.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-ql ^>= 0.1.0.2
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-codeql
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-codeql
, tasty
, tree-sitter-ql ^>= 0.1.0.2

View File

@ -35,6 +35,10 @@ common common
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
library
import: common
@ -46,7 +50,7 @@ library
Core.Eval
Core.Name
build-depends:
base >= 4.13 && < 5
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, fused-syntax
, hashable
@ -55,7 +59,7 @@ library
, prettyprinter >= 1.2.1 && < 2
, prettyprinter-ansi-terminal ^>= 1.1.1
, semantic-analysis ^>= 0
, semantic-source ^>= 0.1.0
, semantic-source ^>= 0.1.0.1
, text ^>= 1.2.3.1
, trifecta >= 2 && < 2.2
, unordered-containers ^>= 0.2.10
@ -67,11 +71,10 @@ test-suite test
main-is: Test.hs
other-modules: Generators
build-depends:
base
, base
, semantic-analysis
, semantic-core
, semantic-source
, fused-effects
, fused-syntax
, hedgehog ^>= 1
, tasty >= 1.2 && <2

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-go ^>= 0.5.0.1
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,19 +49,27 @@ library
Language.Go.Grammar
Language.Go.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-go ^>= 0.5.0.1
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-go
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-go
, tasty
, tree-sitter-go ^>= 0.5.0.1

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-java ^>= 0.7.0.1
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,17 +49,27 @@ library
Language.Java.Grammar
Language.Java.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-java ^>= 0.7.0.1
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-java
, tasty
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-java
, tasty
, tree-sitter-java ^>= 0.7.0.1

View File

@ -20,19 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-json ^>= 0.7.0.1
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -47,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -58,19 +49,24 @@ library
Language.JSON.Grammar
hs-source-dirs: src
default-language: Haskell2010
build-depends:
, base >= 4.13 && < 5
, semantic-ast
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-json ^>= 0.7.0.1
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-json
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-json
, tasty
, tree-sitter-json ^>= 0.7.0.1

View File

@ -34,24 +34,26 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
executable semantic-parse
import: haskell
main-is: Main.hs
-- other-modules:
-- other-extensions:
build-depends: base
, semantic-ast
, tree-sitter ^>= 0.9.0.0
, semantic-source ^>= 0.1.0
, tree-sitter-python ^>= 0.9.0.1
, bytestring
, optparse-applicative
, pretty-simple
, aeson
, bytestring
, aeson-pretty
, semantic-python
, text
build-depends:
, aeson
, aeson-pretty
, base
, bytestring
, optparse-applicative
, pretty-simple
, semantic-ast
, semantic-python
, semantic-source ^>= 0.1.0.1
, tree-sitter-python ^>= 0.9.0.1
hs-source-dirs: app
default-language: Haskell2010

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-proto ^>= 0
, semantic-core ^>= 0.0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-php ^>= 0.5.0.0
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
library
import: haskell
@ -57,3 +47,14 @@ library
Language.PHP.Grammar
Language.PHP.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-php ^>= 0.5.0.0

View File

@ -17,9 +17,9 @@ haskell_library(
deps = [
"//:base",
"//:text",
"@stackage//:proto-lens-jsonpb",
"@stackage//:aeson",
"@stackage//:proto-lens",
"@stackage//:proto-lens-jsonpb",
"@stackage//:proto-lens-runtime",
],
)

View File

@ -24,12 +24,12 @@ library
, Proto.Semantic_Fields
, Proto.Semantic_JSON
build-depends:
base >= 4.13 && < 5
, aeson ^>= 1.4.2.0
, base >= 4.13 && < 5
, aeson ^>= 1.4.2.0
, text ^>= 1.2.3.1
, proto-lens >= 0.5 && < 0.7
, proto-lens >= 0.5 && < 0.8
, proto-lens-jsonpb
, proto-lens-runtime >= 0.5 && <0.7
, proto-lens-runtime >= 0.5 && <0.8
hs-source-dirs: src
default-language: Haskell2010
ghc-options:
@ -46,3 +46,7 @@ library
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module

View File

@ -20,23 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-analysis ^>= 0
, semantic-ast
-- , semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
-- , semantic-scope-graph ^>= 0.0
, semilattices ^>= 0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-python ^>= 0.9.0.2
, containers
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -51,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -67,7 +54,19 @@ library
-- Language.Python.ScopeGraph
Language.Python.Tags
hs-source-dirs: src
build-depends: lens ^>= 4.18
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, fused-syntax
, semantic-analysis ^>= 0
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-python ^>= 0.9.0.2
-- test-suite compiling
-- import: haskell
@ -121,16 +120,13 @@ test-suite test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-python
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-python
, tasty
, tree-sitter-python ^>= 0.9.0.2
executable benchmark
import: haskell
@ -138,7 +134,9 @@ executable benchmark
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"
main-is: Bench.hs
build-depends:
base
, gauge ^>= 0.2.5
, base
, bytestring
, gauge ^>= 0.2.5
, semantic-ast
, semantic-python
, tree-sitter-python ^>= 0.9.0.2

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-ruby ^>= 0.5.0.2
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,22 +49,30 @@ library
Language.Ruby.Grammar
Language.Ruby.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-ruby ^>= 0.5.0.2
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-ruby
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-ruby
, tasty
, tree-sitter-ruby ^>= 0.5.0.2
executable benchmarks
import: haskell
@ -83,19 +81,24 @@ executable benchmarks
main-is: Main.hs
other-modules: Parsing
ghc-options: -static -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"
build-depends: base
, gauge ^>= 0.2.5
, bytestring
, Glob
, lens >= 4.17 && < 4.19
, pathtype ^>= 0.8.1
, semantic-ruby
build-depends:
, base
, bytestring
, gauge ^>= 0.2.5
, Glob
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-ruby
, tree-sitter-ruby ^>= 0.5.0.2
executable tree-sitter-ruby
import: haskell
hs-source-dirs: app
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"
main-is: Main.hs
build-depends: base
, bytestring
, semantic-ruby
build-depends:
, base
, bytestring
, semantic-ast
, semantic-ruby
, tree-sitter-ruby ^>= 0.5.0.2

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-rust ^>= 0.1.0.0
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,32 +49,26 @@ library
Language.Rust.Grammar
Language.Rust.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-rust ^>= 0.1.0.0
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Test.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-rust
, tasty
, tasty-hunit
, text
ghc-options:
-Weverything
-Wno-missing-local-signatures
-Wno-missing-import-lists
-Wno-implicit-prelude
-Wno-safe
-Wno-unsafe
-Wno-name-shadowing
-Wno-monomorphism-restriction
-Wno-missed-specialisations
-Wno-all-missed-specialisations
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-rust
, tasty
, tree-sitter-rust ^>= 0.1.0.0

View File

@ -29,7 +29,6 @@ haskell_library(
"@stackage//:algebraic-graphs",
"@stackage//:fused-effects",
"@stackage//:generic-lens",
"@stackage//:generic-monoid",
"@stackage//:hashable",
"@stackage//:lens",
"@stackage//:pathtype",

View File

@ -36,18 +36,16 @@ library
Data.Module
Data.ScopeGraph
build-depends:
base >= 4.13 && < 5
, aeson
, algebraic-graphs >= 0.3 && < 0.5
, base >= 4.13 && < 5
, containers
, fused-effects ^>= 1.1
, generic-monoid
, generic-lens
, hashable
, lens
, pathtype
, semantic-analysis
, semantic-source ^>= 0.1.0
, semantic-source ^>= 0.1.0.1
, semilattices
, text ^>= 1.2.3.1
hs-source-dirs: src
@ -66,3 +64,7 @@ library
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module

View File

@ -27,9 +27,8 @@ haskell_library(
"//:deepseq",
"//:filepath",
"//:text",
"@lingo",
"@stackage//:lingo",
"@stackage//:aeson",
"@stackage//:generic-monoid",
"@stackage//:hashable",
"@stackage//:pathtype",
"@stackage//:semilattices",
@ -38,10 +37,7 @@ haskell_library(
haskell_test(
name = "test",
srcs = [
"test/Source/Test.hs",
"test/Test.hs",
],
srcs = glob(["test/**/*.hs"]),
compiler_flags = GHC_FLAGS + EXECUTABLE_FLAGS,
deps = [
":semantic-source",

View File

@ -1,7 +1,7 @@
cabal-version: 2.4
name: semantic-source
version: 0.1.0.0
version: 0.1.0.1
synopsis: Types and functionality for working with source code
description: Types and functionality for working with source code (program text).
homepage: https://github.com/github/semantic/tree/master/semantic-source#readme
@ -10,7 +10,7 @@ license: MIT
license-file: LICENSE
author: The Semantic authors
maintainer: opensource+semantic@github.com
copyright: (c) 2019 GitHub, Inc.
copyright: (c) 2020 GitHub, Inc.
category: Data
build-type: Simple
stability: alpha
@ -21,6 +21,7 @@ extra-source-files:
tested-with:
GHC == 8.6.5
GHC == 8.8.1
GHC == 8.10.1
common haskell
default-language: Haskell2010
@ -38,6 +39,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
library
import: haskell
@ -48,39 +53,28 @@ library
Source.Source
Source.Span
build-depends:
aeson ^>= 1.4.2.0
, aeson ^>= 1.4.2.0
, base >= 4.12 && < 5
, bytestring ^>= 0.10.8.2
, deepseq ^>= 1.4.4.0
, containers ^>= 0.6.2
, generic-monoid ^>= 0.1.0.0
, hashable >= 1.2.7 && < 1.4
, lingo ^>= 0.3.2.0
, lingo ^>= 0.5.0.1
, pathtype ^>= 0.8.1
, semilattices ^>= 0.0.0.3
, text ^>= 1.2.3.1
, text ^>= 1.2.3.2
hs-source-dirs: src
test-suite doctest
import: haskell
type: exitcode-stdio-1.0
main-is: Doctest.hs
build-depends:
base
, doctest >= 0.7 && <1.0
, QuickCheck
, semantic-source
hs-source-dirs: test
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Test.hs
other-modules:
Range.Test
Source.Test
build-depends:
base
, base
, hedgehog ^>= 1
, semantic-source
, tasty >= 1.2 && <2

View File

@ -94,7 +94,7 @@ knownLanguage :: Language -> Bool
knownLanguage = (/= Unknown)
extensionsForLanguage :: Language -> [String]
extensionsForLanguage language = T.unpack <$> maybe mempty Lingo.languageExtensions (Map.lookup (languageToText language) Lingo.languages)
extensionsForLanguage language = fmap T.unpack (maybe mempty Lingo.languageExtensions (Map.lookup (languageToText language) Lingo.languages))
forPath :: Path.PartClass.AbsRel ar => Path.File ar -> Language
forPath path =

View File

@ -1,4 +1,4 @@
{-# LANGUAGE DeriveGeneric, DerivingVia, RankNTypes, NamedFieldPuns, OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric, RankNTypes, NamedFieldPuns, OverloadedStrings #-}
module Source.Loc
( Loc(..)
, byteRange_
@ -9,7 +9,6 @@ module Source.Loc
import Control.DeepSeq (NFData)
import Data.Aeson (ToJSON(..), object, (.=))
import Data.Hashable (Hashable)
import Data.Monoid.Generic
import GHC.Generics (Generic)
import Prelude hiding (span)
import Source.Range
@ -20,7 +19,9 @@ data Loc = Loc
, span :: {-# UNPACK #-} !Span
}
deriving (Eq, Ord, Show, Generic)
deriving Semigroup via GenericSemigroup Loc
instance Semigroup Loc where
Loc b1 s1 <> Loc b2 s2 = Loc (b1 <> b2) (s1 <> s2)
instance Hashable Loc
instance NFData Loc
@ -42,4 +43,3 @@ type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s)
lens :: (s -> a) -> (s -> a -> s) -> Lens' s a
lens get put afa s = fmap (put s) (afa (get s))
{-# INLINE lens #-}

View File

@ -25,10 +25,6 @@ data Range = Range
instance Hashable Range
instance NFData Range
-- $
-- prop> a <> (b <> c) === (a <> b) <> (c :: Range)
instance Semigroup Range where
Range start1 end1 <> Range start2 end2 = Range (min start1 start2) (max end1 end2)
@ -60,9 +56,3 @@ type Lens' s a = forall f . Functor f => (a -> f a) -> (s -> f s)
lens :: (s -> a) -> (s -> a -> s) -> Lens' s a
lens get put afa s = fmap (put s) (afa (get s))
{-# INLINE lens #-}
-- $setup
-- >>> import Test.QuickCheck
-- >>> instance Arbitrary Range where arbitrary = Range <$> arbitrary <*> arbitrary ; shrink (Range s e) = Range <$> shrink s <*> shrink e

View File

@ -1,12 +0,0 @@
module Main
( main
) where
import System.Environment
import Test.DocTest
main :: IO ()
main = do
args <- getArgs
autogen <- fmap (<> "/build/doctest/autogen") <$> lookupEnv "HASKELL_DIST_DIR"
doctest (maybe id ((:) . ("-i" <>)) autogen ("-isemantic-source/src" : "--fast" : if null args then ["semantic-source/src"] else args))

View File

@ -0,0 +1,30 @@
module Range.Test
( testTree
) where
import Control.Monad (join)
import Hedgehog hiding (Range)
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import Source.Range
import qualified Test.Tasty as Tasty
import Test.Tasty.Hedgehog (testProperty)
testTree :: Tasty.TestTree
testTree = Tasty.testGroup "Source.Range"
[ Tasty.testGroup "Semigroup"
[ testProperty "associativity" . property $ do
(a, b, c) <- forAll ((,,) <$> range <*> range <*> range)
a <> (b <> c) === (a <> b) <> c
]
]
range :: MonadGen m => m Range
range = Gen.choice [ empty, nonEmpty ] where
point = Gen.int (Range.linear 0 100)
empty = join Range <$> point
nonEmpty = do
start <- point
length <- point
pure $! Range start (start + length + 1)

View File

@ -20,7 +20,7 @@ source r = Gen.frequency [ (1, empty), (20, nonEmpty) ] where
nonEmpty = Source.fromUTF8 <$> Gen.utf8 r (Gen.frequency [ (1, pure '\r'), (1, pure '\n'), (20, Gen.unicode) ])
testTree :: Tasty.TestTree
testTree = Tasty.testGroup "Data.Source"
testTree = Tasty.testGroup "Source.Source"
[ Tasty.testGroup "lineRanges"
[ testProperty "produces 1 more range than there are newlines" . property $ do
source <- forAll (source (Range.linear 0 100))

View File

@ -2,10 +2,12 @@ module Main
( main
) where
import qualified Range.Test as Range
import qualified Source.Test as Source
import Test.Tasty as Tasty
main :: IO ()
main = defaultMain $ testGroup "semantic-source"
[ Source.testTree
[ Range.testTree
, Source.testTree
]

View File

@ -35,6 +35,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
library
import: haskell
@ -42,13 +46,13 @@ library
Tags.Tag
Tags.Tagging.Precise
build-depends:
base >= 4.13 && < 5
, base >= 4.13 && < 5
, bytestring ^>= 0.10.8.2
, fused-effects ^>= 1.1
, semantic-source ^>= 0.1.0
, semantic-proto ^>= 0
, text ^>= 1.2.3.1
, containers ^>= 0.6.0.1
, fused-effects ^>= 1.1
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, text ^>= 1.2.3.1
hs-source-dirs: src
test-suite test
@ -57,11 +61,9 @@ test-suite test
hs-source-dirs: test
main-is: Test.hs
build-depends:
base >= 4.13 && < 5
, hedgehog ^>= 1
, semantic-source ^>= 0.1.0
, base >= 4.13 && < 5
, semantic-source ^>= 0.1.0.1
, semantic-tags
, tasty >= 1.2 && <2
, tasty-hedgehog ^>= 1.0.0.1
, tasty-hunit >= 0.10 && <1
, text ^>= 1.2.3.1

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-tsx ^>= 0.5.0.1
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,19 +49,27 @@ library
Language.TSX.Grammar
Language.TSX.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9
, tree-sitter-tsx ^>= 0.5.0.1
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-tsx
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-tsx
, tasty
, tree-sitter-tsx ^>= 0.5.0.1

View File

@ -20,20 +20,6 @@ tested-with: GHC == 8.6.5
common haskell
default-language: Haskell2010
build-depends: base ^>= 4.13
, fused-effects ^>= 1.1
, fused-syntax
, parsers ^>= 0.12.10
, semantic-ast
, semantic-core ^>= 0.0
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0
, semantic-tags ^>= 0.0
, template-haskell ^>= 2.15
, text ^>= 1.2.3
, tree-sitter ^>= 0.9.0.0
, tree-sitter-typescript ^>= 0.5.0.1
ghc-options:
-Weverything
-Wno-missing-local-signatures
@ -48,6 +34,10 @@ common haskell
-Wno-star-is-type
if (impl(ghc >= 8.8))
ghc-options: -Wno-missing-deriving-strategies
if (impl(ghc >= 8.10))
ghc-options:
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
cpp-options:
-DBAZEL_BUILD=0
@ -59,19 +49,27 @@ library
Language.TypeScript.Grammar
Language.TypeScript.Tags
hs-source-dirs: src
build-depends:
, base >= 4.13 && < 5
, fused-effects ^>= 1.1
, semantic-ast
, semantic-proto ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0.0
, template-haskell >= 2.15 && < 2.17
, text ^>= 1.2.3
, tree-sitter ^>= 0.9.0.0
, tree-sitter-typescript ^>= 0.5.0.1
test-suite test
import: haskell
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: PreciseTest.hs
build-depends: base
, bytestring ^>= 0.10.8.2
, hedgehog >= 0.6 && <2
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-typescript
, tasty
, tasty-hedgehog
, tasty-hunit
, text
build-depends:
, base
, pathtype ^>= 0.8.1
, semantic-ast
, semantic-typescript
, tasty
, tree-sitter-typescript ^>= 0.5.0.1

View File

@ -50,7 +50,7 @@ haskell_library(
name = "semantic",
srcs = glob(["src/**/*.hs"]),
compiler_flags = GHC_FLAGS + ["-XStrictData"],
version = "0.11.0.0",
version = "0.11.0.1",
deps = semantic_common_dependencies + [
"//:base",
"//:deepseq",
@ -75,7 +75,6 @@ haskell_library(
"@stackage//:directory-tree",
"@stackage//:fused-syntax",
"@stackage//:generic-lens",
"@stackage//:generic-monoid",
"@stackage//:haskeline",
"@stackage//:hostname",
"@stackage//:hscolour",

View File

@ -2,10 +2,15 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeApplications #-}
module Tagging (benchmarks) where
module Tagging
( benchmarks
, runTagging
, pythonBenchmarks
, goBenchmarks
, rubyBenchmarks
) where
import Control.Carrier.Parse.Measured
import Control.Carrier.Reader
import Control.Exception (throwIO)
import Control.Monad
import Data.Foldable
@ -15,7 +20,6 @@ import qualified System.Path as Path
import qualified Analysis.File as File
import Data.Flag
import Data.Either (fromRight)
import Proto.Semantic as P hiding (Blob)
import Semantic.Api.Symbols (parseSymbols)
import Semantic.Config as Config

View File

@ -1,7 +1,7 @@
cabal-version: 2.4
name: semantic
version: 0.11.0.0
version: 0.11.0.1
synopsis: Framework and executable for analyzing and diffing untrusted code.
description: Semantic is a library for parsing, analyzing, and comparing source code across many languages.
homepage: http://github.com/github/semantic#readme
@ -10,13 +10,13 @@ license: MIT
license-file: LICENSE
author: The Semantic authors
maintainer: opensource+semantic@github.com
copyright: (c) 2015-2019 GitHub, Inc.
copyright: (c) 2015-2020 GitHub, Inc.
category: Language
build-type: Simple
stability: alpha
extra-source-files: README.md
tested-with: GHC == 8.8.3
tested-with: GHC == 8.10.1
flag release
description: Build with optimizations on (for CI or deployment builds)
@ -47,42 +47,11 @@ common haskell
-Wno-missing-safe-haskell-mode
-Wno-prepositive-qualified-module
-- Except in case of vendored dependencies, these deps should be expressed
-- as caret-operator bounds relative to a version in Stackage.
-- These are currently pinned to lts-13.13.
common dependencies
build-depends: base >= 4.13 && < 5
, aeson ^>= 1.4.2.0
, algebraic-graphs ^>= 0.3
, async ^>= 2.2.1
, bifunctors ^>= 5.5
, bytestring ^>= 0.10.8.2
, containers ^>= 0.6.0.1
, directory ^>= 1.3.3.0
, fused-effects ^>= 1.1
, fused-effects-exceptions ^>= 1.1
, hashable >= 1.2.7 && < 1.4
, tree-sitter ^>= 0.9.0.1
, network ^>= 2.8.0.0
, pathtype ^>= 0.8.1
, process ^>= 1.6.3.0
, recursion-schemes ^>= 5.1
, scientific ^>= 0.3.6.2
, safe-exceptions ^>= 0.1.7.0
, semantic-analysis ^>= 0
, semantic-ast
, semantic-source ^>= 0.1.0
, semilattices ^>= 0.0.0.3
, streaming ^>= 0.2.2.0
, text ^>= 1.2.3.1
, unix ^>= 2.7.2.2
common executable-flags
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m"
library
import: haskell, dependencies
import: haskell
hs-source-dirs: src
exposed-modules: Control.Carrier.Parse.Measured
, Control.Carrier.Parse.Simple
@ -130,67 +99,72 @@ library
-- Custom Prelude
autogen-modules: Paths_semantic
other-modules: Paths_semantic
build-depends: base >= 4.13 && < 5
, ansi-terminal >= 0.8.2 && <1
, array ^>= 0.5.3.0
, attoparsec ^>= 0.13.2.2
, deepseq ^>= 1.4.4.0
, directory-tree ^>= 0.12.1
, filepath ^>= 1.4.2.1
, generic-monoid ^>= 0.1.0.0
, ghc-prim ^>= 0.5.3
, gitrev ^>= 1.3.1
, haskeline ^>= 0.7.5.0
, hostname ^>= 1.0
, hscolour ^>= 1.24.4
, lens >= 4.17 && < 4.19
, network-uri ^>= 2.6.1.0
, optparse-applicative >= 0.14.3 && < 0.16
, parsers ^>= 0.12.9
, prettyprinter >= 1.2 && < 2
, pretty-show ^>= 1.9.5
, proto-lens >= 0.5 && < 0.7
, reducers ^>= 3.12.3
, semantic-go ^>= 0
, semantic-java ^>= 0
, semantic-json ^>= 0
, semantic-php ^>= 0
, semantic-python ^>= 0
, semantic-codeql ^>= 0
, semantic-ruby ^>= 0
, semantic-proto ^>= 0
, semantic-scope-graph ^>= 0
, semantic-tags ^>= 0
, semantic-tsx ^>= 0
, semantic-typescript ^>= 0
, semigroupoids ^>= 5.3.2
, split ^>= 0.2.3.3
, stm-chans ^>= 3.0.0.4
, template-haskell >= 2.14 && < 2.16
, time >= 1.8.0.2 && < 1.10
, utf8-string ^>= 1.0.1.1
, unordered-containers ^>= 0.2.9.0
, vector ^>= 0.12.0.2
, tree-sitter-go ^>= 0.5.0.0
, tree-sitter-java ^>= 0.7.0.0
, tree-sitter-json ^>= 0.7.0.0
, tree-sitter-php ^>= 0.5.0.0
, tree-sitter-python ^>= 0.9.0.1
, tree-sitter-ql ^>= 0.1.0.1
, tree-sitter-ruby ^>= 0.5.0.0
, tree-sitter-rust ^>= 0.1.0.0
, tree-sitter-typescript ^>= 0.5.0.0
, tree-sitter-tsx ^>= 0.5.0.0
-- Except in case of vendored dependencies, these deps should be expressed
-- as caret-operator bounds relative to a version in Stackage.
-- These are currently pinned to lts-13.13.
build-depends:
, aeson ^>= 1.4.2.0
, algebraic-graphs ^>= 0.3
, ansi-terminal >= 0.8.2 && <1
, async ^>= 2.2.1
, base >= 4.13 && < 5
, bytestring ^>= 0.10.8.2
, containers ^>= 0.6.0.1
, directory-tree ^>= 0.12.1
, filepath ^>= 1.4.2.1
, fused-effects ^>= 1.1
, ghc-prim >= 0.5 && < 0.7
, hostname ^>= 1.0
, hscolour ^>= 1.24.4
, lens >= 4.17 && < 4.20
, network ^>= 2.8.0.0
, network-uri ^>= 2.6.1.0
, optparse-applicative >= 0.14.3 && < 0.16
, pathtype ^>= 0.8.1
, pretty-show ^>= 1.9.5
, proto-lens >= 0.5 && < 0.8
, semantic-analysis ^>= 0
, semantic-ast
, semantic-codeql ^>= 0
, semantic-go ^>= 0
, semantic-java ^>= 0
, semantic-json ^>= 0
, semantic-php ^>= 0
, semantic-proto ^>= 0
, semantic-python ^>= 0
, semantic-ruby ^>= 0
, semantic-scope-graph ^>= 0
, semantic-source ^>= 0.1.0.1
, semantic-tags ^>= 0
, semantic-tsx ^>= 0
, semantic-typescript ^>= 0
, semilattices ^>= 0.0.0.3
, split ^>= 0.2.3.3
, stm-chans ^>= 3.0.0.4
, text ^>= 1.2.3.2
, time >= 1.8.0.2 && < 1.10
, tree-sitter ^>= 0.9.0.1
, tree-sitter-go ^>= 0.5.0.0
, tree-sitter-java ^>= 0.7.0.0
, tree-sitter-json ^>= 0.7.0.0
, tree-sitter-php ^>= 0.5.0.0
, tree-sitter-python ^>= 0.9.0.1
, tree-sitter-ql ^>= 0.1.0.1
, tree-sitter-ruby ^>= 0.5.0.0
, tree-sitter-tsx ^>= 0.5.0.0
, tree-sitter-typescript ^>= 0.5.0.0
, unix ^>= 2.7.2.2
executable semantic
import: haskell, dependencies, executable-flags
import: haskell, executable-flags
hs-source-dirs: app
main-is: Main.hs
build-depends: base
, semantic
build-depends:
, base
, semantic
test-suite test
import: haskell, dependencies, executable-flags
import: haskell, executable-flags
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
@ -206,56 +180,67 @@ test-suite test
, SpecHelpers
, Generators
, Properties
build-depends: semantic
, semantic-json
, semantic-tags ^>= 0
, semantic-proto ^>= 0
, tree-sitter-json ^>= 0.7
, Glob ^>= 0.10.0
, hedgehog ^>= 1
, hspec >= 2.6 && <3
, hspec-core >= 2.6 && <3
, hspec-expectations ^>= 0.8.2
, tasty ^>= 1.2.3
, tasty-golden ^>= 2.3.2
, tasty-hedgehog ^>= 1.0.0.1
, tasty-hspec ^>= 1.1.5.1
, tasty-hunit ^>= 0.10.0.2
, HUnit ^>= 1.6.0.0
, temporary ^>= 1.3
build-depends:
, algebraic-graphs ^>= 0.3
, base >= 4.13 && < 5
, bytestring ^>= 0.10.8.2
, fused-effects
, Glob ^>= 0.10.0
, hedgehog ^>= 1
, hspec >= 2.6 && <3
, hspec-expectations ^>= 0.8.2
, network ^>= 2.8.0.0
, pathtype ^>= 0.8.1
, semantic
, semantic-analysis
, semantic-ast
, semantic-proto
, semantic-source ^>= 0.1.0.1
, semantic-tags
, semilattices
, tasty ^>= 1.2.3
, tasty-golden ^>= 2.3.2
, tasty-hedgehog ^>= 1.0.0.1
, tasty-hspec ^>= 1.1.5.1
, tasty-hunit ^>= 0.10.0.2
test-suite parse-examples
import: haskell, dependencies, executable-flags
import: haskell, executable-flags
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Examples.hs
build-depends: semantic
, Glob
, foldl ^>= 1.4.5
, lens >= 4.17 && < 4.19
, resourcet ^>= 1.2
, semantic-proto ^>= 0
, streaming
, streaming-bytestring ^>= 0.1.6
, tasty
, tasty-hunit
build-depends:
, async ^>= 2.2.1
, base
, fused-effects ^>= 1.1
, Glob
, lens >= 4.17 && < 4.20
, pathtype ^>= 0.8.1
, process ^>= 1.6.3.0
, semantic
, semantic-analysis ^>= 0
, semantic-ast
, semantic-proto ^>= 0
, tasty
, tasty-hunit
, text ^>= 1.2.3.2
benchmark benchmarks
import: haskell, dependencies, executable-flags
import: haskell, executable-flags
hs-source-dirs: bench
type: exitcode-stdio-1.0
main-is: Main.hs
other-modules: Tagging
ghc-options: -static
build-depends: base
, algebraic-graphs
, gauge ^>= 0.2.5
, Glob
, lens >= 4.17 && < 4.19
, semantic
, semantic-ast
, semantic-proto
, semantic-source
build-depends:
, base
, fused-effects ^>= 1.1
, gauge ^>= 0.2.5
, Glob
, pathtype ^>= 0.8.1
, semantic
, semantic-analysis ^>= 0
, semantic-proto
source-repository head
type: git

View File

@ -3,7 +3,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-- | A carrier for 'Parse' effects suitable for use in production.
@ -59,7 +58,7 @@ runParser ::
=> Blob
-> Parser term
-> m term
runParser blob@Blob{..} parser = case parser of
runParser blob parser = case parser of
UnmarshalParser language ->
time "parse.tree_sitter_precise_ast_parse" languageTag $ do

View File

@ -3,7 +3,6 @@
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
-- | A carrier for 'Parse' effects suitable for use in the repl, tests, etc.
@ -50,7 +49,7 @@ runParser
-> Blob
-> Parser term
-> m term
runParser timeout blob@Blob{..} parser = case parser of
runParser timeout blob parser = case parser of
UnmarshalParser language ->
parseToPreciseAST timeout timeout language blob
>>= either (throwError . SomeException) pure

View File

@ -52,7 +52,7 @@ makeError s e a = withFrozenCallStack (Error s e a callStack)
-- | Format an 'Error', optionally with reference to the source where it occurred.
formatError :: Flag LogPrintSource -> Flag Colourize -> Blob -> Error String -> String
formatError includeSource colourize blob@Blob{..} Error{..}
formatError includeSource colourize blob Error{..}
= ($ "")
$ withSGRCode colourize [SetConsoleIntensity BoldIntensity] (showSpan path errorSpan . showString ": ")
. withSGRCode colourize [SetColor Foreground Vivid Red] (showString "error") . showString ": " . showExpectation colourize errorExpected errorActual . showChar '\n'

View File

@ -2,12 +2,7 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
@ -50,7 +45,7 @@ parseSymbols blobs = do
pure $ defMessage & P.files .~ toList terms
where
go :: (Has (Error SomeException) sig m, Has Parse sig m) => Blob -> m File
go blob@Blob {..} = catching $ tagsToFile <$> tagsForBlob blob
go blob = catching $ tagsToFile <$> tagsForBlob blob
where
catching m = m `catchError` (\(SomeException e) -> pure $ errorFile (show e))
blobLanguage' = blobLanguage blob

View File

@ -4,7 +4,6 @@
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@ -61,10 +60,10 @@ foldMapM :: (Traversable t, Monoid out, Applicative m) => (a -> m out) -> t a ->
foldMapM f = fmap fold . traverse f
quietTerm :: (Has (Error SomeException) sig m, Has Parse sig m, Has (Reader Config) sig m, MonadIO m) => Blob -> m Builder
quietTerm blob = showTiming blob <$> time' (parseWith showTermParsers (fmap (const (Right ())) . showTerm) blob `catchError` timingError)
quietTerm blob = showTiming <$> time' (parseWith showTermParsers (fmap (const (Right ())) . showTerm) blob `catchError` timingError)
where
timingError (SomeException e) = pure (Left (show e))
showTiming Blob{..} (res, duration) =
showTiming (res, duration) =
let status = if isLeft res then "ERR" else "OK"
in stringUtf8 (status <> "\t" <> show (blobLanguage blob) <> "\t" <> blobFilePath blob <> "\t" <> show duration <> " ms\n")

View File

@ -79,7 +79,7 @@ infoOptions :: Options
infoOptions = defaultOptions { optionsLogLevel = Just Info }
defaultConfig :: Options -> IO Config
defaultConfig options@Options{..} = do
defaultConfig options = do
pid <- getProcessID
hostName <- getHostName
isTerminal <- hIsTerminalDevice stdout

View File

@ -116,7 +116,7 @@ queueLogMessage q@AsyncQueue{..} level message pairs
-- | Queue an error to be reported.
queueErrorReport :: MonadIO io => ErrorQueue -> SomeException -> [(String, String)] -> io ()
queueErrorReport q@AsyncQueue{..} message = liftIO . writeAsyncQueue q . ErrorReport message
queueErrorReport q message = liftIO . writeAsyncQueue q . ErrorReport message
-- | Queue a stat to be sent to statsd.
queueStat :: MonadIO io => StatQueue -> Stat -> io ()

View File

@ -3,7 +3,6 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ImplicitParams #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -O1 #-}
@ -20,7 +19,6 @@ import Control.Monad
import Data.Blob
import Data.Foldable
import Data.Int
import Data.List
import qualified Data.Text as Text
import Data.Traversable
import System.FilePath.Glob
@ -179,7 +177,7 @@ main = withOptions testOptions $ \ config logger statter -> do
let session = TaskSession config "-" False logger statter
allTests <- forConcurrently examples $ \lang@LanguageExample{..} -> do
allTests <- forConcurrently examples $ \lang -> do
let tsDir = Fixture.absRelDir ".."
buildExamples session lang tsDir

View File

@ -1,12 +1,13 @@
{-# LANGUAGE OverloadedStrings, RecordWildCards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Semantic.Stat.Spec (testTree) where
import Control.Exception
import Network.Socket hiding (recv)
import Network.Socket (Family (..), Socket, SocketType (..), close, defaultProtocol, socketPair)
import Network.Socket.ByteString
import Semantic.Telemetry.Stat
import Semantic.Config
import Semantic.Telemetry.Stat
import System.Environment
import Test.Tasty
@ -18,7 +19,7 @@ withSocketPair = bracket create release
release (client, server) = close client >> close server
withEnvironment :: String -> String -> IO () -> IO ()
withEnvironment key value = bracket (setEnv key value) (const (unsetEnv key)) . const
withEnvironment key value = bracket_ (setEnv key value) (unsetEnv key)
-- NOTE: These cannot easily run in parallel because we test things like
-- setting/unsetting the environment.
@ -92,7 +93,7 @@ case_render_tags = do
case_sendstat_delivers_datagram :: Assertion
case_sendstat_delivers_datagram = do
client@StatsClient{..} <- defaultStatsClient
client <- defaultStatsClient
withSocketPair $ \(clientSoc, serverSoc) -> do
sendStat client { statsClientUDPSocket = clientSoc } (increment "app.metric" [])
info <- recv serverSoc 1024

View File

@ -1,14 +1,14 @@
resolver: lts-15.13
resolver: nightly-2020-08-16
packages:
- github: antitypical/fused-syntax
commit: "4a383d57c8fd7592f54a33f43eb9666314a6e80e"
sha256: "aa345f8f04a12beaf8f07620467dee06370b72c763cf2d1c60556878b226fafc"
- github: tclem/proto-lens-jsonpb
commit: "5d40444be689bef1e12cbe38da0261283775ec64"
sha256: "39f783f07aeb64614aadb6ee618d000051c46cc9f511277d87feea6cba8fe955"
- fused-effects-1.1.0.0
- fused-effects-exceptions-1.1.0.0
- fused-effects-readline-0.1.0.0
- semilattices-0.0.0.4
- haskeline-0.8.0.0
- tree-sitter-0.9.0.2
- unliftio-core-0.2.0.1
- lingo-0.5.0.1
- proto-lens-jsonpb-0.2.0.2