File tree Expand file tree Collapse file tree 3 files changed +45
-30
lines changed Expand file tree Collapse file tree 3 files changed +45
-30
lines changed Original file line number Diff line number Diff line change @@ -38,13 +38,25 @@ type nonrec t = t0 option
3838
3939let use_default = None
4040
41+ let prepare_warning_concat ~(beg : bool ) s =
42+ let s = Ext_string. trim s in
43+ if s = " " then s
44+ else
45+ match s.[0 ] with
46+ | '0' .. '9' -> if beg then " -w +" ^ s else " +" ^ s
47+ | 'a' .. 'z' ->
48+ if beg then " -w " ^ s else " +" ^ s
49+ | _ ->
50+ if beg then " -w " ^ s else s
51+
4152let to_merlin_string x =
4253 " -w " ^ Bsc_warnings. defaults_w
4354 ^
4455 (match x with
4556 | Some {number = None }
4657 | None -> Ext_string. empty
47- | Some {number = Some x } -> Ext_string. trim x )
58+ | Some {number = Some x } ->
59+ prepare_warning_concat ~beg: false x )
4860
4961
5062
@@ -75,19 +87,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
7587let to_bsb_string ~toplevel warning =
7688 match warning with
7789 | None -> Ext_string. empty
78- | Some warning ->
79- " -w " ^ Bsc_warnings. defaults_w ^
90+ | Some warning ->
8091 (match warning.number with
8192 | None ->
8293 Ext_string. empty
8394 | Some x ->
84- let content =
85- Ext_string. trim x in
86- if content = " " then content
87- else
88- match content.[0 ] with
89- | '0' .. '9' -> " +" ^ content
90- | _ -> content
95+ prepare_warning_concat ~beg: true x
9196 ) ^
9297 if toplevel then
9398 match warning.error with
Original file line number Diff line number Diff line change @@ -7030,13 +7030,25 @@ type nonrec t = t0 option
70307030
70317031let use_default = None
70327032
7033+ let prepare_warning_concat ~(beg : bool) s =
7034+ let s = Ext_string.trim s in
7035+ if s = "" then s
7036+ else
7037+ match s.[0] with
7038+ | '0' .. '9' -> if beg then "-w +" ^ s else "+" ^ s
7039+ | 'a' .. 'z' ->
7040+ if beg then "-w " ^ s else "+" ^ s
7041+ | _ ->
7042+ if beg then "-w " ^ s else s
7043+
70337044let to_merlin_string x =
70347045 "-w " ^ Bsc_warnings.defaults_w
70357046 ^
70367047 (match x with
70377048 | Some {number =None}
70387049 | None -> Ext_string.empty
7039- | Some {number = Some x} -> Ext_string.trim x )
7050+ | Some {number = Some x} ->
7051+ prepare_warning_concat ~beg:false x )
70407052
70417053
70427054
@@ -7067,19 +7079,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
70677079let to_bsb_string ~toplevel warning =
70687080 match warning with
70697081 | None -> Ext_string.empty
7070- | Some warning ->
7071- "-w " ^ Bsc_warnings.defaults_w ^
7082+ | Some warning ->
70727083 (match warning.number with
70737084 | None ->
70747085 Ext_string.empty
70757086 | Some x ->
7076- let content =
7077- Ext_string.trim x in
7078- if content = "" then content
7079- else
7080- match content.[0] with
7081- | '0' .. '9' -> "+" ^ content
7082- | _ -> content
7087+ prepare_warning_concat ~beg:true x
70837088 ) ^
70847089 if toplevel then
70857090 match warning.error with
Original file line number Diff line number Diff line change @@ -7030,13 +7030,25 @@ type nonrec t = t0 option
70307030
70317031let use_default = None
70327032
7033+ let prepare_warning_concat ~(beg : bool) s =
7034+ let s = Ext_string.trim s in
7035+ if s = "" then s
7036+ else
7037+ match s.[0] with
7038+ | '0' .. '9' -> if beg then "-w +" ^ s else "+" ^ s
7039+ | 'a' .. 'z' ->
7040+ if beg then "-w " ^ s else "+" ^ s
7041+ | _ ->
7042+ if beg then "-w " ^ s else s
7043+
70337044let to_merlin_string x =
70347045 "-w " ^ Bsc_warnings.defaults_w
70357046 ^
70367047 (match x with
70377048 | Some {number =None}
70387049 | None -> Ext_string.empty
7039- | Some {number = Some x} -> Ext_string.trim x )
7050+ | Some {number = Some x} ->
7051+ prepare_warning_concat ~beg:false x )
70407052
70417053
70427054
@@ -7067,19 +7079,12 @@ let from_map (m : Ext_json_types.t Map_string.t) =
70677079let to_bsb_string ~toplevel warning =
70687080 match warning with
70697081 | None -> Ext_string.empty
7070- | Some warning ->
7071- "-w " ^ Bsc_warnings.defaults_w ^
7082+ | Some warning ->
70727083 (match warning.number with
70737084 | None ->
70747085 Ext_string.empty
70757086 | Some x ->
7076- let content =
7077- Ext_string.trim x in
7078- if content = "" then content
7079- else
7080- match content.[0] with
7081- | '0' .. '9' -> "+" ^ content
7082- | _ -> content
7087+ prepare_warning_concat ~beg:true x
70837088 ) ^
70847089 if toplevel then
70857090 match warning.error with
You can’t perform that action at this time.
0 commit comments