type component = {displayName: string};
let module Bar = {
let createElement c::c=? children => {
displayName: "test"
};
};
let module Nesting = {
let createElement children => {
displayName: "test"
};
};
let module Much = {
let createElement children => {
displayName: "test"
};
};
let module Foo = {
let createElement a::a=? b::b=? children => {
displayName: "test"
};
};
let module One = {
let createElement
test::test=?
foo::foo=?
children => {
displayName: "test"
};
let createElementobvioustypo
test::test
children => {
displayName: "test"
};
};
let module Two = {
let createElement foo::foo=? children => {
displayName: "test"
};
};
let module Sibling = {
let createElement
foo::foo=?
(children: list component) => {
displayName: "test"
};
};
let module Test = {
let createElement yo::yo=? children => {
displayName: "test"
};
};
let module So = {
let createElement children => {
displayName: "test"
};
};
let module Foo2 = {
let createElement children => {
displayName: "test"
};
};
let module Text = {
let createElement children => {
displayName: "test"
};
};
let module Exp = {
let createElement children => {
displayName: "test"
};
};
let module Pun = {
let createElement intended::intended=? children => {
displayName: "test"
};
};
let module Namespace = {
let module Foo = {
let createElement
intended::intended=?
anotherOptional::x=100
children => {
displayName: "test"
};
};
};
let module LotsOfArguments = {
let createElement
argument1::argument1=?
argument2::argument2=?
argument3::argument3=?
argument4::argument4=?
argument5::argument5=?
argument6::argument6=?
children => {
displayName: "test"
};
};
let div argument1::argument1=? children => {
displayName: "test"
};
let module List1 = {
let createElement children => {
displayName: "test"
};
};
let module List2 = {
let createElement children => {
displayName: "test"
};
};
let module List3 = {
let createElement children => {
displayName: "test"
};
};
let (/><) a b => a + b;
let (><) a b => a + b;
let (/>) a b => a + b;
let (><\/) a b => a + b;
let tag1 = 5 />< 6;
let tag2 = 5 >< 7;
let tag3 = 5 /> 7;
let tag4 = 5 ><\/ 7;
let b = 2;
let selfClosing = ;
let selfClosing2 = ;
let selfClosing3 =
;
let a = a + 2) /> ;
let a3 = ;
let a4 =
;
let a5 = "testing a string here" ;
let a6 =
"testing a string here"
"another string"
(2 + 4)
;
let intended = true;
let punning = ;
let namespace = ;
let c = ;
let d = ;
let spaceBefore =
;
let spaceBefore2 = ;
let siblingNotSpaced =
;
let jsxInList = [];
let jsxInList2 = [];
let jsxInListA = [];
let jsxInListB = [];
let jsxInListC = [];
let jsxInListD = [];
let jsxInList3 = [, , ];
let jsxInList4 = [, , ];
let jsxInList5 = [, ];
let jsxInList6 = [, ];
let jsxInList7 = [, ];
let jsxInList8 = [, ];
let testFunc b => b;
let jsxInFnCall = testFunc ;
let lotsOfArguments =
;
let lowerCase =
;
let b = 0;
let d = 0;
/*
* Should pun the first example:
*/
let a = 5 ;
let a = 5 ;
let a = 5 ;
let a = 0.55 ;
let a = Foo.createElement "" [@JSX];
let ident = a ;
let fragment1 = <> >;
let fragment2 = <> >;
let fragment3 = <> >;
let fragment4 = <> >;
let fragment5 = <> >;
let fragment6 = <> >;
let fragment7 = <> >;
let fragment8 = <> >;
let fragment9 = <> 2 2 2 2 >;
let fragment10 = <> 2.2 3.2 4.6 1.2 >;
let fragment11 = <> "str" >;
let fragment12 = <> (6 + 2) (6 + 2) (6 + 2) >;
let fragment13 = <> fragment11 fragment11 >;
let listOfItems1 = 1 2 3 4 5 ;
let listOfItems2 =
1.0 2.8 3.8 4.0 5.1 ;
let listOfItems3 =
fragment11 fragment11 ;
/*
* Several sequential simple jsx expressions must be separated with a space.
*/
let thisIsRight a b => ();
let tagOne children => ();
let tagTwo children => ();
/* thisIsWrong ; */
thisIsRight ;
/* thisIsWrong ; */
thisIsRight ;
let a children => ();
let b children => ();
let thisIsOkay =
;
let thisIsAlsoOkay =
;
/* Doesn't make any sense, but suppose you defined an
infix operator to compare jsx */
< ;
> ;
< ;
> ;
let listOfListOfJsx = [<> >];
let listOfListOfJsx = [<> >];
let listOfListOfJsx = [
<> >,
<> >
];
let listOfListOfJsx = [
<> >,
<> >,
...listOfListOfJsx
];
let sameButWithSpaces = [<> >];
let sameButWithSpaces = [<> >];
let sameButWithSpaces = [
<> >,
<> >
];
let sameButWithSpaces = [
<> >,
<> >,
...sameButWithSpaces
];
/*
* Test named tag right next to an open bracket.
*/
let listOfJsx = [];
let listOfJsx = [];
let listOfJsx = [, ];
let listOfJsx = [, , ...listOfJsx];
let sameButWithSpaces = [];
let sameButWithSpaces = [];
let sameButWithSpaces = [, ];
let sameButWithSpaces = [
,
,
...sameButWithSpaces
];
/**
* Test no conflict with polymorphic variant types.
*/
type thisType = [ | `Foo | `Bar];
type t 'a = [< thisType] as 'a;
let asd =
"a" "b" [@foo];
let asd2 =
One.createElementobvioustypo
test::false
["a", "b"]
[@JSX]
[@foo];
let span
test::(test: bool)
foo::(foo: int)
children => 1;
let asd =
"a" "b" [@foo];
/* "video" call doesn't end with a list, so the expression isn't converted to JSX */
let video test::(test: bool) children => children;
let asd2 = video test::false 10 [@JSX] [@foo];
let div children => 1;
((fun () => div) ()) [] [@JSX];
let myFun () =>
<>
>;
let myFun () => <> >;
let myFun () =>
<>
>;
/**
* Children should wrap without forcing attributes to.
*/
;
/**
* Failing test cases:
*/
/* let res = ) > */
/* */
/* ; */
/* let res = ) />; */