Skip to content

Commit a328c0a

Browse files
committed
add tests
1 parent b5e0f67 commit a328c0a

File tree

6 files changed

+112
-0
lines changed

6 files changed

+112
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
Syntax error!
3+
/.../fixtures/inline_types_multiple_on_same_key.res:3:11-47
4+
5+
1 │ type options = {
6+
2 │ extra?: {
7+
3 │ name: result<{first: bool}, {second: bool}>,
8+
4 │ },
9+
5 │ }
10+
11+
Only one inline record definition is allowed per record field. This defines more than one inline record.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
We've found a bug for you!
3+
/.../fixtures/inline_types_record_type_params.res:13:12-15
4+
5+
11 ┆ name: "test",
6+
12 ┆ superExtra: {
7+
13 ┆ age: 2222,
8+
14 ┆ },
9+
15 ┆ otherExtra: Some({test: true, anotherInlined: {record: true}}),
10+
11+
This has type: int
12+
But it's expected to have type: string
13+
14+
You can convert int to string with Belt.Int.toString.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
type options<'age> = {
2+
extra?: {
3+
name: string,
4+
superExtra?: {age: 'age},
5+
otherExtra: option<{test: bool, anotherInlined: {record: bool}}>,
6+
},
7+
}
8+
9+
let opts2: options<string> = {
10+
extra: {
11+
name: "test",
12+
superExtra: {
13+
age: 2222,
14+
},
15+
otherExtra: Some({test: true, anotherInlined: {record: true}}),
16+
},
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type options = {
2+
extra?: {
3+
name: result<{first: bool}, {second: bool}>,
4+
},
5+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
4+
let options = {
5+
extra: {
6+
name: "test",
7+
superExtra: {
8+
age: 2222
9+
},
10+
otherExtra: {
11+
test: true,
12+
anotherInlined: {
13+
record: true
14+
}
15+
}
16+
}
17+
};
18+
19+
let opts2 = {
20+
extra: {
21+
name: "test",
22+
superExtra: {
23+
age: "1234"
24+
},
25+
otherExtra: {
26+
test: true,
27+
anotherInlined: {
28+
record: true
29+
}
30+
}
31+
}
32+
};
33+
34+
export {
35+
options,
36+
opts2,
37+
}
38+
/* No side effect */
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
type options<'age> = {
2+
extra?: {
3+
name: string,
4+
superExtra?: {age: 'age},
5+
otherExtra: option<{test: bool, anotherInlined: {record: bool}}>,
6+
},
7+
}
8+
9+
let options = {
10+
extra: {
11+
name: "test",
12+
superExtra: {
13+
age: 2222,
14+
},
15+
otherExtra: Some({test: true, anotherInlined: {record: true}}),
16+
},
17+
}
18+
19+
let opts2: options<string> = {
20+
extra: {
21+
name: "test",
22+
superExtra: {
23+
age: "1234",
24+
},
25+
otherExtra: Some({test: true, anotherInlined: {record: true}}),
26+
},
27+
}

0 commit comments

Comments
 (0)