Skip to content

Commit 08263a3

Browse files
authored
feat(docs): warn that imports are automatically exported (#3368)
1 parent 703c5e0 commit 08263a3

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

dev-docs/CHANGELOG-DOCS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
77
## Doc: 2025-06
88

99
- Adjusted inline code tag highlighting to support global Starlight themes, and modified the One Light color theme to support proper highlighting of `keyword.operator.new` TextMate scopes: PR [#3346](https://github.com/tact-lang/tact/pull/3346)
10+
- Warned that imports are automatically exported: PR [#TBD](https://github.com/tact-lang/tact/pull/TBD)
1011

1112
## Doc: 2025-05
1213

docs/src/content/docs/book/import.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,29 @@ Additionally, the Tact compiler has a versatile set of standard libraries which
1111

1212
All imported code is combined together with yours, so it's important to avoid name collisions and always double-check the sources!
1313

14+
Moreover, imports are transitive and are always automatically exported — if an `a.tact` imports `b.tact`, which in turn imports `c.tact`, then all the definitions from `c.tact` are immediately accessible in `a.tact` without an explicit import of `c.tact` to it.
15+
16+
```tact title="c.tact"
17+
trait StatelessGetters {
18+
get fun bar(): Int { return 42 }
19+
get fun baz(): Int { return 43 }
20+
}
21+
```
22+
23+
```tact title="b.tact"
24+
import "c.tact";
25+
```
26+
27+
```tact title="a.tact"
28+
import "b.tact";
29+
30+
// Definitions available in "c.tact" are now available in this file
31+
// due to their transitive import from the "b.tact" file.
32+
contract Transitive() with StatelessGetters {}
33+
```
34+
35+
This behavior may change in future major releases.
36+
1437
:::
1538

1639
## Import Tact code

0 commit comments

Comments
 (0)