Skip to content

Commit 36c82b5

Browse files
committed
tests
1 parent a4ef9f4 commit 36c82b5

File tree

3 files changed

+143
-14
lines changed

3 files changed

+143
-14
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
type options = {
3+
extra: {
4+
name: string,
5+
superExtra: {age: int},
6+
},
7+
}
8+
9+
let options = {
10+
extra: {
11+
name: "test",
12+
superExtra: {
13+
age: 2222,
14+
},
15+
},
16+
}
17+
18+
// options
19+
// ^hov
20+
21+
// options.extra
22+
// ^hov
23+
24+
// options.extra.superExtra
25+
// ^hov
26+
27+
// options.extra.superExtra.age
28+
// ^hov
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
Hover src/NestedRecords.res 17:5
2+
Nothing at that position. Now trying to use completion.
3+
posCursor:[17:5] posNoWhite:[17:4] Found expr:[17:3->17:10]
4+
Pexp_ident options:[17:3->17:10]
5+
Completable: Cpath Value[options]
6+
Package opens Pervasives.JsxModules.place holder
7+
ContextPath Value[options]
8+
Path options
9+
Package opens Pervasives.JsxModules.place holder
10+
{"contents": {"kind": "markdown", "value": "```rescript\noptions\n```\n\n---\n\n```\n \n```\n```rescript\ntype options = {extra: \\\"options.extra\"}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22NestedRecords.res%22%2C1%2C0%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype options.extra = {\n name: string,\n superExtra: \\\"options.extra.superExtra\",\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22NestedRecords.res%22%2C2%2C9%5D)\n"}}
11+
12+
Hover src/NestedRecords.res 20:13
13+
Nothing at that position. Now trying to use completion.
14+
posCursor:[20:13] posNoWhite:[20:12] Found expr:[20:3->20:16]
15+
Pexp_field [20:3->20:10] extra:[20:11->20:16]
16+
Completable: Cpath Value[options].extra
17+
Package opens Pervasives.JsxModules.place holder
18+
ContextPath Value[options].extra
19+
ContextPath Value[options]
20+
Path options
21+
ContextPath Value[options]->extra
22+
ContextPath Value[options]
23+
Path options
24+
CPPipe pathFromEnv: found:true
25+
Path NestedRecords.extra
26+
Package opens Pervasives.JsxModules.place holder
27+
{"contents": {"kind": "markdown", "value": "```rescript\n\\\"options.extra\"\n```\n\n---\n\n```\n \n```\n```rescript\ntype options.extra = {\n name: string,\n superExtra: \\\"options.extra.superExtra\",\n}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22NestedRecords.res%22%2C2%2C9%5D)\n\n\n---\n\n```\n \n```\n```rescript\ntype options.extra.superExtra = {age: int}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22NestedRecords.res%22%2C4%2C16%5D)\n"}}
28+
29+
Hover src/NestedRecords.res 23:26
30+
Nothing at that position. Now trying to use completion.
31+
posCursor:[23:26] posNoWhite:[23:25] Found expr:[23:3->23:27]
32+
Pexp_field [23:3->23:16] superExtra:[23:17->23:27]
33+
Completable: Cpath Value[options].extra.superExtra
34+
Package opens Pervasives.JsxModules.place holder
35+
ContextPath Value[options].extra.superExtra
36+
ContextPath Value[options].extra
37+
ContextPath Value[options]
38+
Path options
39+
ContextPath Value[options]->extra
40+
ContextPath Value[options]
41+
Path options
42+
CPPipe pathFromEnv: found:true
43+
Path NestedRecords.extra
44+
ContextPath Value[options].extra->superExtra
45+
ContextPath Value[options].extra
46+
ContextPath Value[options]
47+
Path options
48+
ContextPath Value[options]->extra
49+
ContextPath Value[options]
50+
Path options
51+
CPPipe pathFromEnv: found:true
52+
Path NestedRecords.extra
53+
CPPipe pathFromEnv: found:true
54+
Path NestedRecords.superExtra
55+
Package opens Pervasives.JsxModules.place holder
56+
{"contents": {"kind": "markdown", "value": "```rescript\n\\\"options.extra.superExtra\"\n```\n\n---\n\n```\n \n```\n```rescript\ntype options.extra.superExtra = {age: int}\n```\nGo to: [Type definition](command:rescript-vscode.go_to_location?%5B%22NestedRecords.res%22%2C4%2C16%5D)\n"}}
57+
58+
Hover src/NestedRecords.res 26:29
59+
Nothing at that position. Now trying to use completion.
60+
posCursor:[26:29] posNoWhite:[26:28] Found expr:[26:3->26:31]
61+
Pexp_field [26:3->26:27] age:[26:28->26:31]
62+
Completable: Cpath Value[options].extra.superExtra.age
63+
Package opens Pervasives.JsxModules.place holder
64+
ContextPath Value[options].extra.superExtra.age
65+
ContextPath Value[options].extra.superExtra
66+
ContextPath Value[options].extra
67+
ContextPath Value[options]
68+
Path options
69+
ContextPath Value[options]->extra
70+
ContextPath Value[options]
71+
Path options
72+
CPPipe pathFromEnv: found:true
73+
Path NestedRecords.extra
74+
ContextPath Value[options].extra->superExtra
75+
ContextPath Value[options].extra
76+
ContextPath Value[options]
77+
Path options
78+
ContextPath Value[options]->extra
79+
ContextPath Value[options]
80+
Path options
81+
CPPipe pathFromEnv: found:true
82+
Path NestedRecords.extra
83+
CPPipe pathFromEnv: found:true
84+
Path NestedRecords.superExtra
85+
ContextPath Value[options].extra.superExtra->age
86+
ContextPath Value[options].extra.superExtra
87+
ContextPath Value[options].extra
88+
ContextPath Value[options]
89+
Path options
90+
ContextPath Value[options]->extra
91+
ContextPath Value[options]
92+
Path options
93+
CPPipe pathFromEnv: found:true
94+
Path NestedRecords.extra
95+
ContextPath Value[options].extra->superExtra
96+
ContextPath Value[options].extra
97+
ContextPath Value[options]
98+
Path options
99+
ContextPath Value[options]->extra
100+
ContextPath Value[options]
101+
Path options
102+
CPPipe pathFromEnv: found:true
103+
Path NestedRecords.extra
104+
CPPipe pathFromEnv: found:true
105+
Path NestedRecords.superExtra
106+
CPPipe pathFromEnv: found:true
107+
Path NestedRecords.age
108+
Package opens Pervasives.JsxModules.place holder
109+
{"contents": {"kind": "markdown", "value": "```rescript\nint\n```"}}
110+

tests/syntax_tests/data/parsing/errors/typeDef/expected/inlineRecord.res.txt

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@
1111
An inline record type declaration is only allowed in a variant constructor's declaration
1212

1313

14-
Syntax error!
15-
syntax_tests/data/parsing/errors/typeDef/inlineRecord.res:14:5-10
16-
17-
12 ┆ name: string,
18-
13 ┆ address: {
19-
14 ┆ street: string,
20-
15 ┆ country: string,
21-
16 ┆ }
22-
23-
An inline record type declaration is only allowed in a variant constructor's declaration
24-
25-
2614
Syntax error!
2715
syntax_tests/data/parsing/errors/typeDef/inlineRecord.res:19:21-31
2816

@@ -39,10 +27,13 @@ type nonrec entity =
3927
| Student of {
4028
name: string ;
4129
reportCard: < passing: bool ;score: int > }
42-
type nonrec user =
30+
type user.address = {
31+
street: string ;
32+
country: string }[@@inlineRecordDefinition ]
33+
and user =
4334
{
4435
name: string ;
45-
address: < street: string ;country: string > }
36+
address: ((user.address)[@inlineRecordReference ]) }
4637
let make
4738
[arity:1](props :
4839
< handleClick: Click.t -> unit (a:1) ;value: string > )

0 commit comments

Comments
 (0)