Skip to content

Commit bcc7abb

Browse files
authored
feat(tolk/grammar): don't use builtin_type at all (#130)
1 parent 569bc55 commit bcc7abb

File tree

13 files changed

+57
-27
lines changed

13 files changed

+57
-27
lines changed

server/src/e2e/tolk/testcases/completion/keywords.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ fun foo() {
138138
24 bits{X}
139139
24 bool
140140
24 builder
141-
24 builtin_type
142141
24 bytes32
143142
24 bytesN
144143
24 bytes{X}
@@ -156,6 +155,7 @@ fun foo() {
156155
24 int8
157156
24 intN
158157
24 int{X}
158+
24 map
159159
24 never
160160
24 null
161161
24 self
@@ -324,7 +324,6 @@ fun foo() {
324324
24 bits{X}
325325
24 bool
326326
24 builder
327-
24 builtin_type
328327
24 bytes32
329328
24 bytesN
330329
24 bytes{X}
@@ -342,6 +341,7 @@ fun foo() {
342341
24 int8
343342
24 intN
344343
24 int{X}
344+
24 map
345345
24 never
346346
24 null
347347
24 self
@@ -499,7 +499,6 @@ fun foo() {
499499
24 bits{X}
500500
24 bool
501501
24 builder
502-
24 builtin_type
503502
24 bytes32
504503
24 bytesN
505504
24 bytes{X}
@@ -517,6 +516,7 @@ fun foo() {
517516
24 int8
518517
24 intN
519518
24 int{X}
519+
24 map
520520
24 never
521521
24 null
522522
24 self

server/src/e2e/tolk/testcases/completion/returns.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fun test() {
1010
========================================================================
1111
Return completion inside void function
1212
========================================================================
13-
type void = builtin_type;
13+
type void = builtin;
1414

1515
fun test(): void {
1616
ret<caret>
@@ -31,7 +31,7 @@ fun test(): int {
3131
========================================================================
3232
Return completion inside int27 function
3333
========================================================================
34-
type intN = builtin_type;
34+
type intN = builtin;
3535

3636
fun test(): int27 {
3737
ret<caret>
@@ -43,7 +43,7 @@ fun test(): int27 {
4343
========================================================================
4444
Return completion inside uint32 function
4545
========================================================================
46-
type uintN = builtin_type;
46+
type uintN = builtin;
4747

4848
fun test(): uint32 {
4949
ret<caret>

server/src/e2e/tolk/testcases/completion/struct.test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct Foo {
9494
24 int64
9595
24 int8
9696
24 int{X}
97+
24 map
9798
24 never
9899
24 null
99100
24 self

server/src/e2e/tolk/testcases/completion/top-level.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ fun foo() {
213213
24 bits{X}
214214
24 bool
215215
24 builder
216-
24 builtin_type
217216
24 bytes32
218217
24 bytesN
219218
24 bytes{X}
@@ -231,6 +230,7 @@ fun foo() {
231230
24 int8
232231
24 intN
233232
24 int{X}
233+
24 map
234234
24 never
235235
24 null
236236
24 self

server/src/e2e/tolk/testcases/documentation/basic.test

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ struct <caret>Foo {}
9797
```tolk
9898
struct Foo {}
9999
```
100+
**Size:** 0 bits.
101+
102+
---
100103

101104
========================================================================
102105
Struct documentation without body
@@ -107,9 +110,15 @@ struct <caret>Bar
107110
```tolk
108111
struct Foo {}
109112
```
113+
**Size:** 0 bits.
114+
115+
---
110116
```tolk
111117
struct Bar {}
112118
```
119+
**Size:** 0 bits.
120+
121+
---
113122

114123
========================================================================
115124
Struct documentation
@@ -125,6 +134,9 @@ struct Foo {
125134
other: bool
126135
}
127136
```
137+
**Size:** 258 bits.
138+
139+
---
128140

129141
========================================================================
130142
Struct with pack prefix documentation
@@ -140,6 +152,9 @@ struct (0x100) Foo {
140152
other: bool
141153
}
142154
```
155+
**Size:** 270 bits.
156+
157+
---
143158

144159
========================================================================
145160
Struct with pack prefix and type parameters documentation
@@ -155,6 +170,9 @@ struct (0x100) Foo<TName, TValue=int> {
155170
other: TValue
156171
}
157172
```
173+
**Size:** 12..9999 bits, 0..8 refs.
174+
175+
---
158176

159177
========================================================================
160178
Struct with comments inside
@@ -186,6 +204,10 @@ struct CreateMessageOptions<TBody = never> {
186204
body: TBody
187205
}
188206
```
207+
**Size:** 8..9999 bits, 0..9 refs.
208+
209+
---
210+
189211
Options for creating an outgoing message.
190212
Consider [createMessage] for examples.
191213

@@ -252,6 +274,9 @@ type <caret>Int = int;
252274
```tolk
253275
type Int = int
254276
```
277+
**Size:** 257 bits.
278+
279+
---
255280

256281
========================================================================
257282
Type alias with type parameters documentation
@@ -263,6 +288,9 @@ type Foo<TName, TValue=slice> =
263288
| TName
264289
| TValue
265290
```
291+
**Size:** 1..9999 bits, 0..4 refs.
292+
293+
---
266294

267295
========================================================================
268296
Type alias with union type documentation
@@ -294,11 +322,14 @@ type AllowedOpToElectorContract =
294322
| AllowedOpElectorVoteForComplaint
295323
| AllowedOpElectorVoteForProposal
296324
```
325+
**Size:** 2 bits.
326+
327+
---
297328

298329
========================================================================
299330
Type alias with builtin type
300331
========================================================================
301-
type <caret>int = builtin_type;
332+
type <caret>int = builtin;
302333
------------------------------------------------------------------------
303334
```tolk
304335
type int = builtin

server/src/e2e/tolk/testcases/documentation/map.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type dict =
4949
| cell
5050
| null
5151
```
52+
**Size:** 1 bit, 0..1 refs.
53+
54+
---
55+
5256
In Tolk v1.x there would be a type `map<K,V>`.
5357
Currently, working with dictionaries is still low-level, with raw cells.
5458
But just for clarity, we use "dict" instead of a "cell?" where a cell-dictionary is assumed.

server/src/e2e/tolk/testcases/documentation/tlb.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
========================================================================
22
Struct field int32 tlb type
33
========================================================================
4-
type intN = builtin_type;
4+
type intN = builtin;
55

66
struct Foo {
77
value: <caret>int32,
@@ -18,7 +18,7 @@ type int32 = builtin
1818
========================================================================
1919
Struct field uint32 tlb type
2020
========================================================================
21-
type uintN = builtin_type;
21+
type uintN = builtin;
2222

2323
struct Foo {
2424
value: <caret>uint32,
@@ -35,7 +35,7 @@ type uint32 = builtin
3535
========================================================================
3636
Struct field int24 tlb type
3737
========================================================================
38-
type intN = builtin_type;
38+
type intN = builtin;
3939

4040
struct Foo {
4141
value: <caret>int24,
@@ -54,7 +54,7 @@ Arbitrary bit-width signed integer type
5454
========================================================================
5555
Struct field uint244 tlb type
5656
========================================================================
57-
type uintN = builtin_type;
57+
type uintN = builtin;
5858

5959
struct Foo {
6060
value: <caret>uint244,
@@ -73,7 +73,7 @@ Arbitrary bit-width unsigned integer type
7373
========================================================================
7474
Struct field uint9999 tlb type
7575
========================================================================
76-
type uintN = builtin_type;
76+
type uintN = builtin;
7777

7878
struct Foo {
7979
value: <caret>uint9999,

server/src/e2e/tolk/testcases/resolving/basic.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ fun test() {
294294
========================================================================
295295
Function and type with the same name
296296
========================================================================
297-
type address = builtin_type;
297+
type address = builtin;
298298

299299
fun address(): <caret>address {}
300300

@@ -308,7 +308,7 @@ fun test() {
308308
========================================================================
309309
Function and type with the same name 2
310310
========================================================================
311-
type address = builtin_type;
311+
type address = builtin;
312312

313313
fun address(): <caret>address {}
314314

@@ -324,7 +324,7 @@ fun test() {
324324
========================================================================
325325
Variable shadowing for function
326326
========================================================================
327-
type address = builtin_type;
327+
type address = builtin;
328328

329329
fun address(): <caret>address {}
330330

server/src/e2e/tolk/testcases/types/basic.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ ok
245245
========================================================================
246246
Null literal type inference
247247
========================================================================
248-
type null = builtin_type;
248+
type null = builtin;
249249

250250
fun main() {
251251
val data = null;

server/src/languages/tolk/TypeInferer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ export class TypeInferer {
700700
if (underlyingType === null) return null
701701

702702
const underlyingTypeName = underlyingType.text
703-
if (underlyingTypeName === "builtin_type" || underlyingTypeName === "builtin") {
703+
if (underlyingTypeName === "builtin") {
704704
const name = resolved.name()
705705
switch (name) {
706706
case "void": {

0 commit comments

Comments
 (0)