Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion quality/compile_check.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def ghc_check_argv(argv, scratch):

_OCAML_DROP = ["-bin-annot", "-annot", "-c"]

_OCAML_VALUE_FLAGS = ["-w", "-warn-error"]

_OCAML_FLAGS = ["-stop-after", "typing", "-error-style", "short", "-color", "never"]

def _basename(path):
Expand All @@ -156,7 +158,10 @@ def ocaml_check_argv(argv, scratch):
output = ""
compiles = 0
take = ""
previous = ""
for arg in argv[1:]:
value_of = previous
previous = arg
if take != "":
if take == "-o":
output = arg
Expand All @@ -166,7 +171,7 @@ def ocaml_check_argv(argv, scratch):
intf = arg
take = ""
continue
if arg.startswith("@"):
if arg.startswith("@") and value_of not in _OCAML_VALUE_FLAGS:
return _fail("params files are not supported (found " + arg + ")")
if arg in ["-o", "-impl", "-intf"]:
take = arg
Expand Down
5 changes: 5 additions & 0 deletions quality/compile_check_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ def compile_check_unit_tests(name):
ocaml_check_argv([_OCAMLC, "@a.params", "-c", "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error != "",
True,
),
expect_equal(
"ocaml warning specs starting with @ are flag values",
ocaml_check_argv([_OCAMLC, "-w", "@[email protected]", "-warn-error", "@8", "-c", "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error,
"",
),
expect_equal(
"ocaml without -c is rejected",
ocaml_check_argv([_OCAMLC, "-impl", "p/m.ml", "-o", "out/M.cmo"], "tmp").error != "",
Expand Down
Loading