mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-11 04:45:57 +03:00
Disable deriving-defaults per file (#8684)
Disabling it per target works nicely for compilation but it gets annoying in ghci since the warnings are still triggered. We could disable it everywhere but I think the warning is generally useful. I tried patching proto3-suite to use DerivingStrategies but that doesn’t work because haskell-src is dead and doesn’t support it. So for now adding it to the per-file list seems like the best option. changelog_begin changelog_end
This commit is contained in:
parent
218f65ef6c
commit
5d91a25306
1
3rdparty/haskell/BUILD.bazel
vendored
1
3rdparty/haskell/BUILD.bazel
vendored
@ -36,7 +36,6 @@ da_haskell_library(
|
||||
"//ledger-api/grpc-definitions:google-protobuf-haskellpb-sources",
|
||||
"//ledger-api/grpc-definitions:google-rpc-haskellpb-sources",
|
||||
],
|
||||
compiler_flags = ["-Wno-deriving-defaults"],
|
||||
hackage_deps = [
|
||||
"base",
|
||||
"bytestring",
|
||||
|
@ -216,6 +216,8 @@ haskell_cabal_library(
|
||||
sha256 = "b294ff0fe24c6c256dc8eca1d44c2a9a928b9a1bc70ddce6a1d059499edea119",
|
||||
strip_prefix = "proto3-suite-0af901f9ef3b9719e08eae4fab8fd700d6c8047a",
|
||||
urls = ["https://github.com/awakesecurity/proto3-suite/archive/0af901f9ef3b9719e08eae4fab8fd700d6c8047a.tar.gz"],
|
||||
patches = ["@com_github_digital_asset_daml//bazel_tools:haskell_proto3_suite_deriving_defaults.patch"],
|
||||
patch_args = ["-p1"],
|
||||
)
|
||||
|
||||
http_archive(
|
||||
|
21
bazel_tools/haskell_proto3_suite_deriving_defaults.patch
Normal file
21
bazel_tools/haskell_proto3_suite_deriving_defaults.patch
Normal file
@ -0,0 +1,21 @@
|
||||
GHC 8.10 enables -Wderiving-defaults as part of -Wall.
|
||||
It’s a useful warning so we want to keep it. However,
|
||||
proto3-suite generates code that triggers this warning.
|
||||
Now ideally, we would just switch proto3-suite over to
|
||||
DerivingStrategies but unfortunately haskell-src, the library
|
||||
used to generate the Haskell source, does not support that.
|
||||
So instead, we disable the warning on a per file basis.
|
||||
The warning only exists in GHC >= 8.10 so we cannot
|
||||
upstream this atm.
|
||||
diff --git a/src/Proto3/Suite/DotProto/Generate.hs b/src/Proto3/Suite/DotProto/Generate.hs
|
||||
index 566b8a9..fae46a4 100644
|
||||
--- a/src/Proto3/Suite/DotProto/Generate.hs
|
||||
+++ b/src/Proto3/Suite/DotProto/Generate.hs
|
||||
@@ -127,6 +127,7 @@ renderHsModuleForDotProto extraInstanceFiles dotProto importCtxt = do
|
||||
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
|
||||
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
|
||||
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
|
||||
+ {-# OPTIONS_GHC -Wno-deriving-defaults #-}
|
||||
|
||||
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
|
||||
|]
|
@ -67,7 +67,6 @@ genrule(
|
||||
da_haskell_library(
|
||||
name = "repl_service_haskell_proto",
|
||||
srcs = [":repl_service_haskell_proto_src"],
|
||||
compiler_flags = ["-Wno-deriving-defaults"],
|
||||
hackage_deps = [
|
||||
"base",
|
||||
"bytestring",
|
||||
|
@ -81,7 +81,6 @@ da_haskell_library(
|
||||
srcs = [":daml_lf_dev_archive_haskell_proto_src"],
|
||||
compiler_flags = [
|
||||
"-O0",
|
||||
"-Wno-deriving-defaults",
|
||||
], # disable optimization as this is otherwise way too slow to compile.
|
||||
hackage_deps = [
|
||||
"base",
|
||||
|
@ -225,7 +225,6 @@ da_haskell_library(
|
||||
],
|
||||
compiler_flags = [
|
||||
"-O0",
|
||||
"-Wno-deriving-defaults",
|
||||
],
|
||||
hackage_deps = [
|
||||
"base",
|
||||
|
Loading…
Reference in New Issue
Block a user