Skip to content

Commit 90ca7b7

Browse files
author
Hongbo Zhang
committed
add more examples
1 parent 72bf1fa commit 90ca7b7

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

jscomp/test/.depend

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ mt.cmj : ../stdlib/list.cmi mt.cmi
333333
mt.cmx : ../stdlib/list.cmx mt.cmi
334334
mt_global.cmj : mt.cmi mt_global.cmi
335335
mt_global.cmx : mt.cmx mt_global.cmi
336+
nested_obj_literal.cmj :
337+
nested_obj_literal.cmx :
336338
nested_obj_test.cmj :
337339
nested_obj_test.cmx :
338340
number_lexer.cmj : ../stdlib/sys.cmi ../stdlib/lexing.cmi
@@ -989,6 +991,8 @@ mt.cmo : ../stdlib/list.cmi mt.cmi
989991
mt.cmj : ../stdlib/list.cmj mt.cmi
990992
mt_global.cmo : mt.cmi mt_global.cmi
991993
mt_global.cmj : mt.cmj mt_global.cmi
994+
nested_obj_literal.cmo :
995+
nested_obj_literal.cmj :
992996
nested_obj_test.cmo :
993997
nested_obj_test.cmj :
994998
number_lexer.cmo : ../stdlib/sys.cmi ../stdlib/lexing.cmi

jscomp/test/nested_obj_literal.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
3+
let structural_obj = { x = { y = { z = 3 }}} [@bs.obj]
4+
(* compiler inferred type :
5+
val structural_obj : < x : < y : < z : int > > > [@bs.obj] *)
6+
7+
type 'a x = {x : 'a }
8+
type 'a y = {y : 'a}
9+
type 'a z = { z : 'a}
10+
let f_record = { x = { y = { z = 3 }}}
11+
(* compiler inferred type :
12+
val f_record : int z y x *)
13+

jscomp/test/test.mllib

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,4 +312,5 @@ attr_test
312312

313313
uncurry_glob_test
314314

315-
nested_obj_test
315+
nested_obj_test
316+
nested_obj_literal

lib/js/test/nested_obj_literal.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// GENERATED CODE BY BUCKLESCRIPT VERSION 0.5.0 , PLEASE EDIT WITH CARE
2+
'use strict';
3+
4+
5+
var structural_obj = {
6+
"x": {
7+
"y": {
8+
"z": 3
9+
}
10+
}
11+
};
12+
13+
var f_record = /* record */[/* x : record */[/* y : record */[/* z */3]]];
14+
15+
exports.structural_obj = structural_obj;
16+
exports.f_record = f_record;
17+
/* structural_obj Not a pure module */

0 commit comments

Comments
 (0)