Skip to content

fix a regression (see the commit in msg) #2144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2017
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
2 changes: 1 addition & 1 deletion jscomp/all.depend
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ bsb/bsb_package_specs.cmx : ext/string_map.cmx ext/literals.cmx \
bsb/bsb_exception.cmx bsb/bsb_config.cmx bsb/bsb_build_schemas.cmx \
bsb/bsb_package_specs.cmi
bsb/bsb_parse_sources.cmx : ext/string_vec.cmx ext/string_set.cmx \
ext/string_map.cmx ext/literals.cmx ext/ext_string.cmx \
ext/string_map.cmx ext/literals.cmx ext/ext_string.cmx ext/ext_path.cmx \
ext/ext_namespace.cmx ext/ext_list.cmx ext/ext_json_types.cmx \
ext/ext_json.cmx ext/ext_filename.cmx ext/ext_file_pp.cmx \
ext/ext_array.cmx bsb/bsb_log.cmx bsb/bsb_exception.cmx \
Expand Down
16 changes: 14 additions & 2 deletions jscomp/bin/all_ounit_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11578,7 +11578,7 @@ type t


(**
[combine path1 path2]
[combine path1 path2]
1. add some simplifications when concatenating
2. when [path2] is absolute, return [path2]
*)
Expand All @@ -11596,7 +11596,7 @@ val chop_extension_if_any : string -> string

val chop_all_extensions_if_any :
string -> string

(**
{[
get_extension "a.txt" = ".txt"
Expand Down Expand Up @@ -11633,6 +11633,12 @@ val normalize_absolute_path : string -> string

val absolute_path : string Lazy.t -> string -> string

(** [concat dirname filename]
The same as {!Filename.concat} except a tiny optimization
for current directory simplification
*)
val concat : string -> string -> string

val check_suffix_case :
string -> string -> bool
end = struct
Expand Down Expand Up @@ -11935,6 +11941,12 @@ let absolute cwd s =
| File x -> File (absolute_path cwd x )
| Dir x -> Dir (absolute_path cwd x)

let concat dirname filename =
if filename = Filename.current_dir_name then dirname
else if dirname = Filename.current_dir_name then filename
else Filename.concat dirname filename


let check_suffix_case =
Ext_string.ends_with
end
Expand Down
22 changes: 17 additions & 5 deletions jscomp/bin/bsb.ml
Original file line number Diff line number Diff line change
Expand Up @@ -5247,7 +5247,7 @@ type t


(**
[combine path1 path2]
[combine path1 path2]
1. add some simplifications when concatenating
2. when [path2] is absolute, return [path2]
*)
Expand All @@ -5265,7 +5265,7 @@ val chop_extension_if_any : string -> string

val chop_all_extensions_if_any :
string -> string

(**
{[
get_extension "a.txt" = ".txt"
Expand Down Expand Up @@ -5302,6 +5302,12 @@ val normalize_absolute_path : string -> string

val absolute_path : string Lazy.t -> string -> string

(** [concat dirname filename]
The same as {!Filename.concat} except a tiny optimization
for current directory simplification
*)
val concat : string -> string -> string

val check_suffix_case :
string -> string -> bool
end = struct
Expand Down Expand Up @@ -5604,6 +5610,12 @@ let absolute cwd s =
| File x -> File (absolute_path cwd x )
| Dir x -> Dir (absolute_path cwd x)

let concat dirname filename =
if filename = Filename.current_dir_name then dirname
else if dirname = Filename.current_dir_name then filename
else Filename.concat dirname filename


let check_suffix_case =
Ext_string.ends_with
end
Expand Down Expand Up @@ -9665,7 +9677,7 @@ let rec
(
parsing_source_dir_map
{cxt with
cwd = Filename.concat cxt.cwd (Ext_filename.simple_convert_node_path_to_os_path x);
cwd = Ext_path.concat cxt.cwd (Ext_filename.simple_convert_node_path_to_os_path x);
traverse = true
} String_map.empty ++ origin
)
Expand Down Expand Up @@ -9720,7 +9732,7 @@ and parsing_single_source ({not_dev; dir_index ; cwd} as cxt ) (x : Ext_json_typ
else
parsing_source_dir_map
{cxt with
cwd = Filename.concat cwd (Ext_filename.simple_convert_node_path_to_os_path dir)}
cwd = Ext_path.concat cwd (Ext_filename.simple_convert_node_path_to_os_path dir)}
String_map.empty
| Obj {map} ->
let current_dir_index =
Expand All @@ -9743,7 +9755,7 @@ and parsing_single_source ({not_dev; dir_index ; cwd} as cxt ) (x : Ext_json_typ
in
parsing_source_dir_map
{cxt with dir_index = current_dir_index;
cwd= Filename.concat cwd dir} map
cwd= Ext_path.concat cwd dir} map
| _ -> empty
and parsing_arr_sources cxt (file_groups : Ext_json_types.t array) =
Array.fold_left (fun origin x ->
Expand Down
16 changes: 14 additions & 2 deletions jscomp/bin/bsb_helper.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2155,7 +2155,7 @@ type t


(**
[combine path1 path2]
[combine path1 path2]
1. add some simplifications when concatenating
2. when [path2] is absolute, return [path2]
*)
Expand All @@ -2173,7 +2173,7 @@ val chop_extension_if_any : string -> string

val chop_all_extensions_if_any :
string -> string

(**
{[
get_extension "a.txt" = ".txt"
Expand Down Expand Up @@ -2210,6 +2210,12 @@ val normalize_absolute_path : string -> string

val absolute_path : string Lazy.t -> string -> string

(** [concat dirname filename]
The same as {!Filename.concat} except a tiny optimization
for current directory simplification
*)
val concat : string -> string -> string

val check_suffix_case :
string -> string -> bool
end = struct
Expand Down Expand Up @@ -2512,6 +2518,12 @@ let absolute cwd s =
| File x -> File (absolute_path cwd x )
| Dir x -> Dir (absolute_path cwd x)

let concat dirname filename =
if filename = Filename.current_dir_name then dirname
else if dirname = Filename.current_dir_name then filename
else Filename.concat dirname filename


let check_suffix_case =
Ext_string.ends_with
end
Expand Down
16 changes: 14 additions & 2 deletions jscomp/bin/whole_compiler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -24819,7 +24819,7 @@ type t


(**
[combine path1 path2]
[combine path1 path2]
1. add some simplifications when concatenating
2. when [path2] is absolute, return [path2]
*)
Expand All @@ -24837,7 +24837,7 @@ val chop_extension_if_any : string -> string

val chop_all_extensions_if_any :
string -> string

(**
{[
get_extension "a.txt" = ".txt"
Expand Down Expand Up @@ -24874,6 +24874,12 @@ val normalize_absolute_path : string -> string

val absolute_path : string Lazy.t -> string -> string

(** [concat dirname filename]
The same as {!Filename.concat} except a tiny optimization
for current directory simplification
*)
val concat : string -> string -> string

val check_suffix_case :
string -> string -> bool
end = struct
Expand Down Expand Up @@ -25176,6 +25182,12 @@ let absolute cwd s =
| File x -> File (absolute_path cwd x )
| Dir x -> Dir (absolute_path cwd x)

let concat dirname filename =
if filename = Filename.current_dir_name then dirname
else if dirname = Filename.current_dir_name then filename
else Filename.concat dirname filename


let check_suffix_case =
Ext_string.ends_with
end
Expand Down
6 changes: 3 additions & 3 deletions jscomp/bsb/bsb_parse_sources.ml
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ let rec
(
parsing_source_dir_map
{cxt with
cwd = Filename.concat cxt.cwd (Ext_filename.simple_convert_node_path_to_os_path x);
cwd = Ext_path.concat cxt.cwd (Ext_filename.simple_convert_node_path_to_os_path x);
traverse = true
} String_map.empty ++ origin
)
Expand Down Expand Up @@ -415,7 +415,7 @@ and parsing_single_source ({not_dev; dir_index ; cwd} as cxt ) (x : Ext_json_typ
else
parsing_source_dir_map
{cxt with
cwd = Filename.concat cwd (Ext_filename.simple_convert_node_path_to_os_path dir)}
cwd = Ext_path.concat cwd (Ext_filename.simple_convert_node_path_to_os_path dir)}
String_map.empty
| Obj {map} ->
let current_dir_index =
Expand All @@ -438,7 +438,7 @@ and parsing_single_source ({not_dev; dir_index ; cwd} as cxt ) (x : Ext_json_typ
in
parsing_source_dir_map
{cxt with dir_index = current_dir_index;
cwd= Filename.concat cwd dir} map
cwd= Ext_path.concat cwd dir} map
| _ -> empty
and parsing_arr_sources cxt (file_groups : Ext_json_types.t array) =
Array.fold_left (fun origin x ->
Expand Down
3 changes: 2 additions & 1 deletion jscomp/build_tests/namespace/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ child_process.execSync(`bsb -clean-world && bsb -make-world`, {cwd:__dirname, st

var x = require('./src/demo.bs.js')
var assert = require('assert')

var demo_bs_js = fs.readFileSync('./src/demo.bs.js','utf8')
assert.ok(demo_bs_js.includes('liba/src/demo.bs.js'))
assert.equal(x.v, 3 )

var merlin = fs.readFileSync(path.join(__dirname,'.merlin'), 'utf8')
Expand Down
6 changes: 6 additions & 0 deletions jscomp/ext/ext_path.ml
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,11 @@ let absolute cwd s =
| File x -> File (absolute_path cwd x )
| Dir x -> Dir (absolute_path cwd x)

let concat dirname filename =
if filename = Filename.current_dir_name then dirname
else if dirname = Filename.current_dir_name then filename
else Filename.concat dirname filename


let check_suffix_case =
Ext_string.ends_with
10 changes: 8 additions & 2 deletions jscomp/ext/ext_path.mli
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type t


(**
[combine path1 path2]
[combine path1 path2]
1. add some simplifications when concatenating
2. when [path2] is absolute, return [path2]
*)
Expand All @@ -47,7 +47,7 @@ val chop_extension_if_any : string -> string

val chop_all_extensions_if_any :
string -> string

(**
{[
get_extension "a.txt" = ".txt"
Expand Down Expand Up @@ -84,5 +84,11 @@ val normalize_absolute_path : string -> string

val absolute_path : string Lazy.t -> string -> string

(** [concat dirname filename]
The same as {!Filename.concat} except a tiny optimization
for current directory simplification
*)
val concat : string -> string -> string

val check_suffix_case :
string -> string -> bool