Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions server/src/e2e/tolk/testcases/completion/keywords.test
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ fun foo() {
24 bits{X}
24 bool
24 builder
24 builtin_type
24 bytes32
24 bytesN
24 bytes{X}
Expand All @@ -156,6 +155,7 @@ fun foo() {
24 int8
24 intN
24 int{X}
24 map
24 never
24 null
24 self
Expand Down Expand Up @@ -324,7 +324,6 @@ fun foo() {
24 bits{X}
24 bool
24 builder
24 builtin_type
24 bytes32
24 bytesN
24 bytes{X}
Expand All @@ -342,6 +341,7 @@ fun foo() {
24 int8
24 intN
24 int{X}
24 map
24 never
24 null
24 self
Expand Down Expand Up @@ -499,7 +499,6 @@ fun foo() {
24 bits{X}
24 bool
24 builder
24 builtin_type
24 bytes32
24 bytesN
24 bytes{X}
Expand All @@ -517,6 +516,7 @@ fun foo() {
24 int8
24 intN
24 int{X}
24 map
24 never
24 null
24 self
Expand Down
6 changes: 3 additions & 3 deletions server/src/e2e/tolk/testcases/completion/returns.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fun test() {
========================================================================
Return completion inside void function
========================================================================
type void = builtin_type;
type void = builtin;

fun test(): void {
ret<caret>
Expand All @@ -31,7 +31,7 @@ fun test(): int {
========================================================================
Return completion inside int27 function
========================================================================
type intN = builtin_type;
type intN = builtin;

fun test(): int27 {
ret<caret>
Expand All @@ -43,7 +43,7 @@ fun test(): int27 {
========================================================================
Return completion inside uint32 function
========================================================================
type uintN = builtin_type;
type uintN = builtin;

fun test(): uint32 {
ret<caret>
Expand Down
1 change: 1 addition & 0 deletions server/src/e2e/tolk/testcases/completion/struct.test
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct Foo {
24 int64
24 int8
24 int{X}
24 map
24 never
24 null
24 self
Expand Down
2 changes: 1 addition & 1 deletion server/src/e2e/tolk/testcases/completion/top-level.test
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ fun foo() {
24 bits{X}
24 bool
24 builder
24 builtin_type
24 bytes32
24 bytesN
24 bytes{X}
Expand All @@ -231,6 +230,7 @@ fun foo() {
24 int8
24 intN
24 int{X}
24 map
24 never
24 null
24 self
Expand Down
33 changes: 32 additions & 1 deletion server/src/e2e/tolk/testcases/documentation/basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ struct <caret>Foo {}
```tolk
struct Foo {}
```
**Size:** 0 bits.

---

========================================================================
Struct documentation without body
Expand All @@ -107,9 +110,15 @@ struct <caret>Bar
```tolk
struct Foo {}
```
**Size:** 0 bits.

---
```tolk
struct Bar {}
```
**Size:** 0 bits.

---

========================================================================
Struct documentation
Expand All @@ -125,6 +134,9 @@ struct Foo {
other: bool
}
```
**Size:** 258 bits.

---

========================================================================
Struct with pack prefix documentation
Expand All @@ -140,6 +152,9 @@ struct (0x100) Foo {
other: bool
}
```
**Size:** 270 bits.

---

========================================================================
Struct with pack prefix and type parameters documentation
Expand All @@ -155,6 +170,9 @@ struct (0x100) Foo<TName, TValue=int> {
other: TValue
}
```
**Size:** 12..9999 bits, 0..8 refs.

---

========================================================================
Struct with comments inside
Expand Down Expand Up @@ -186,6 +204,10 @@ struct CreateMessageOptions<TBody = never> {
body: TBody
}
```
**Size:** 8..9999 bits, 0..9 refs.

---

Options for creating an outgoing message.
Consider [createMessage] for examples.

Expand Down Expand Up @@ -252,6 +274,9 @@ type <caret>Int = int;
```tolk
type Int = int
```
**Size:** 257 bits.

---

========================================================================
Type alias with type parameters documentation
Expand All @@ -263,6 +288,9 @@ type Foo<TName, TValue=slice> =
| TName
| TValue
```
**Size:** 1..9999 bits, 0..4 refs.

---

========================================================================
Type alias with union type documentation
Expand Down Expand Up @@ -294,11 +322,14 @@ type AllowedOpToElectorContract =
| AllowedOpElectorVoteForComplaint
| AllowedOpElectorVoteForProposal
```
**Size:** 2 bits.

---

========================================================================
Type alias with builtin type
========================================================================
type <caret>int = builtin_type;
type <caret>int = builtin;
------------------------------------------------------------------------
```tolk
type int = builtin
Expand Down
4 changes: 4 additions & 0 deletions server/src/e2e/tolk/testcases/documentation/map.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ type dict =
| cell
| null
```
**Size:** 1 bit, 0..1 refs.

---

In Tolk v1.x there would be a type `map<K,V>`.
Currently, working with dictionaries is still low-level, with raw cells.
But just for clarity, we use "dict" instead of a "cell?" where a cell-dictionary is assumed.
Expand Down
10 changes: 5 additions & 5 deletions server/src/e2e/tolk/testcases/documentation/tlb.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
========================================================================
Struct field int32 tlb type
========================================================================
type intN = builtin_type;
type intN = builtin;

struct Foo {
value: <caret>int32,
Expand All @@ -18,7 +18,7 @@ type int32 = builtin
========================================================================
Struct field uint32 tlb type
========================================================================
type uintN = builtin_type;
type uintN = builtin;

struct Foo {
value: <caret>uint32,
Expand All @@ -35,7 +35,7 @@ type uint32 = builtin
========================================================================
Struct field int24 tlb type
========================================================================
type intN = builtin_type;
type intN = builtin;

struct Foo {
value: <caret>int24,
Expand All @@ -54,7 +54,7 @@ Arbitrary bit-width signed integer type
========================================================================
Struct field uint244 tlb type
========================================================================
type uintN = builtin_type;
type uintN = builtin;

struct Foo {
value: <caret>uint244,
Expand All @@ -73,7 +73,7 @@ Arbitrary bit-width unsigned integer type
========================================================================
Struct field uint9999 tlb type
========================================================================
type uintN = builtin_type;
type uintN = builtin;

struct Foo {
value: <caret>uint9999,
Expand Down
6 changes: 3 additions & 3 deletions server/src/e2e/tolk/testcases/resolving/basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ fun test() {
========================================================================
Function and type with the same name
========================================================================
type address = builtin_type;
type address = builtin;

fun address(): <caret>address {}

Expand All @@ -308,7 +308,7 @@ fun test() {
========================================================================
Function and type with the same name 2
========================================================================
type address = builtin_type;
type address = builtin;

fun address(): <caret>address {}

Expand All @@ -324,7 +324,7 @@ fun test() {
========================================================================
Variable shadowing for function
========================================================================
type address = builtin_type;
type address = builtin;

fun address(): <caret>address {}

Expand Down
2 changes: 1 addition & 1 deletion server/src/e2e/tolk/testcases/types/basic.test
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ ok
========================================================================
Null literal type inference
========================================================================
type null = builtin_type;
type null = builtin;

fun main() {
val data = null;
Expand Down
2 changes: 1 addition & 1 deletion server/src/languages/tolk/TypeInferer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ export class TypeInferer {
if (underlyingType === null) return null

const underlyingTypeName = underlyingType.text
if (underlyingTypeName === "builtin_type" || underlyingTypeName === "builtin") {
if (underlyingTypeName === "builtin") {
const name = resolved.name()
switch (name) {
case "void": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ export class ReferenceCompletionProcessor implements ScopeProcessor {
if (this.ctx.isType) {
if (node instanceof NamedNode) {
const name = node.name()
if (
name === "builtin_type" ||
name === "intN" ||
name === "uintN" ||
name === "nitsN" ||
name === "bytesN"
) {
if (name === "intN" || name === "uintN" || name === "nitsN" || name === "bytesN") {
// intN-like types implemented in VariableSizeTypeCompletionProvider
return false
}
Expand Down
2 changes: 1 addition & 1 deletion server/src/languages/tolk/documentation/documentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export function generateTolkDocFor(node: NamedNode, place: SyntaxNode): string |
const alias = new TypeAlias(node.node, node.file)
const underlyingTypeNode = alias.underlyingType()
const underlyingTypeText = underlyingTypeNode?.text ?? ""
if (underlyingTypeText === "builtin_type") {
if (underlyingTypeText === "builtin") {
const typeName = place.text
const bitTypeNameOrUndefined = bitTypeName(typeName)
const tlbDoc =
Expand Down
2 changes: 1 addition & 1 deletion server/src/languages/tolk/stubs/stubs.tolk
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ type self = builtin;
/// ```
/// var maybeValue: int? = null;
/// ```
type null = builtin_type;
type null = builtin;

// builtin operators
// they are internally stored as functions, because at IR level, there is no difference
Expand Down
Loading