Skip to content

Commit 2a1c07a

Browse files
authored
Accept the -safe-string flag but make it a no-op (#1544)
from voodoos/issue1518-make-safe-string-noop
2 parents 2fd3d4c + 962b9aa commit 2a1c07a

File tree

3 files changed

+43
-6
lines changed

3 files changed

+43
-6
lines changed

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
merlin 4.7.1
2+
==========
3+
Thu Dec 13 12:49:42 CEST 2022
4+
5+
+ merlin binary
6+
- Restore compatibility with the compielr command line by accepting the
7+
`-safe-string` flag as a no-op instead of rejecting it. (#1544, fixes
8+
#1518)
9+
110
merlin 4.7
211
==========
312
Thu Nov 24 17:49:42 CEST 2022

src/kernel/mconfig.ml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,20 +133,20 @@ module Verbosity = struct
133133

134134
let default = Lvl 0
135135

136-
let to_int t ~for_smart =
137-
match t with
136+
let to_int t ~for_smart =
137+
match t with
138138
| Smart -> for_smart
139139
| Lvl v -> v
140140

141141
let param_spec = "\"smart\" | <integer>"
142142

143-
let of_string = function
144-
| "smart" -> Smart
143+
let of_string = function
144+
| "smart" -> Smart
145145
| maybe_int ->
146146
try Lvl (int_of_string maybe_int)
147147
with _ -> invalid_arg ("argument should be: " ^ param_spec)
148148

149-
let to_string = function
149+
let to_string = function
150150
| Smart -> "smart"
151151
| Lvl v -> "lvl " ^ (string_of_int v)
152152

@@ -366,7 +366,7 @@ let query_flags = [
366366
"-verbosity",
367367
Marg.param Verbosity.param_spec (fun verbosity query ->
368368
let verbosity =
369-
Verbosity.of_string verbosity
369+
Verbosity.of_string verbosity
370370
in
371371
{query with verbosity}),
372372
"\"smart\" | <integer> Verbosity determines the number of \
@@ -501,6 +501,11 @@ let ocaml_flags = [
501501
Marg.unit (fun ocaml -> {ocaml with threads = `None}),
502502
" Add support for VM-scheduled threads library"
503503
);
504+
(
505+
"-safe-string",
506+
Marg.unit (fun ocaml -> ocaml),
507+
" Default to true unconditionally since 5.00"
508+
);
504509
(
505510
"-nopervasives",
506511
Marg.unit (fun ocaml -> {ocaml with nopervasives = true}),

tests/test-dirs/issue1518.t

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$ cat >dune-project <<EOF
2+
> (lang dune 2.0)
3+
> EOF
4+
5+
$ cat >main.ml <<EOF
6+
> print_endline "42"
7+
> EOF
8+
9+
$ cat >dune <<EOF
10+
> (executable
11+
> (name main)
12+
> (flags :standard -safe-string))
13+
> EOF
14+
15+
16+
$ dune exec ./main.exe
17+
42
18+
19+
In 5.0 the compiler still accept the deleted flag "-safe-string".
20+
It simply is a no-op. Merlin should ignore it as well.
21+
$ $MERLIN single errors -filename main.ml <main.ml |
22+
> jq '.value'
23+
[]

0 commit comments

Comments
 (0)