From c4deaa99f9c006eb94f6c555e88e1e6198688f05 Mon Sep 17 00:00:00 2001 From: "pr-automation-bot-public[bot]" Date: Tue, 4 Aug 2026 09:17:52 +0000 Subject: [PATCH] chore: bump Motoko to v1.13.0 --- .sources/VERSIONS | 2 +- .sources/motoko | 2 +- .../motoko/fundamentals/modules-imports.md | 21 +++++++++++++++++++ docs/languages/motoko/reference/changelog.md | 13 ++++++++++++ .../motoko/reference/language-manual.md | 5 ++++- 5 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.sources/VERSIONS b/.sources/VERSIONS index ffffe4b6..24c3a7eb 100644 --- a/.sources/VERSIONS +++ b/.sources/VERSIONS @@ -57,7 +57,7 @@ chain-fusion-signer v0.4.0 papi v0.1.1 168bc9d ic-pub-key v1.0.1 f89fa55 icp-cli v1.1.0 fe4af7c -motoko v1.12.0 ee5391df8 +motoko v1.13.0 cd63c2e motoko-core v2.4.0 cd37dbf cdk-rs ic-cdk v0.20.1 / ic-cdk-timers v1.0.0 / ic-cdk-executor v2.0.0 317f55c candid 2025-12-18 # candid v0.10.20, didc v0.5.4 2e4a2cf diff --git a/.sources/motoko b/.sources/motoko index ee5391df..cd63c2e6 160000 --- a/.sources/motoko +++ b/.sources/motoko @@ -1 +1 @@ -Subproject commit ee5391df85959cf28c95ffc6021ab395cc459e31 +Subproject commit cd63c2e6707e3d45313c9d11ab4b9eb86c64c334 diff --git a/docs/languages/motoko/fundamentals/modules-imports.md b/docs/languages/motoko/fundamentals/modules-imports.md index d2adaccb..3d61a26f 100644 --- a/docs/languages/motoko/fundamentals/modules-imports.md +++ b/docs/languages/motoko/fundamentals/modules-imports.md @@ -145,6 +145,27 @@ When importing from another canister, the canister must be listed as a dependenc ::: +## Importing a local `.did` file + +A Candid interface file can be imported with the `idl:` URI scheme to get Motoko **types only**: not a canister handle: + +```motoko no-repl +import S "idl:interfaces/ledger.did"; + +type Ledger = S.Self; // actor { ... } from the Candid service +type Account = S.Account; // named Candid types (PascalCased when unambiguous) +``` + +`S` is a module of type aliases (only types declared in that `.did` file, not transitive Candid imports). It cannot be used to call methods. For a live reference, use a separate `canister:` / `ic:` import, or `actor "" : S.Self`. Types-only and actor imports of the same `.did` path are distinct and can be used together. + +As with any module import, a pattern can bind selected types directly: + +```motoko no-repl +import { type Self; type Account } "idl:interfaces/ledger.did"; +``` + +Snake_case Candid type names are exported in PascalCase when that does not collide with another type in the same file (`user_id` → `UserId`). If both `user_id` and `UserId` exist, both keep their original names. Names that do not start with a lowercase letter (`HTTP_request`, `_internal`) are kept as-is. + ## Importing actor classes When imported, an [actor](./actors/actors-async.md) class provides a type definition describing the class interface and a function that returns an instance of the class. diff --git a/docs/languages/motoko/reference/changelog.md b/docs/languages/motoko/reference/changelog.md index 5aa87e4c..65ee6f1b 100644 --- a/docs/languages/motoko/reference/changelog.md +++ b/docs/languages/motoko/reference/changelog.md @@ -8,6 +8,19 @@ sidebar: # Motoko compiler changelog +## 1.13.0 (2026-08-03) + +* motoko (`moc`) + + * feat: import a local Candid file as a types-only Motoko module via the `idl:` URI scheme — + `import S "idl:foo.did"` exposes `S.Self` (the service actor type) and named + Candid types, PascalCased when unambiguous (e.g. `user_id` → `S.UserId`). No principal or + `--actor-idl` flags required (#6263). + + * chore: multi-value Wasm codegen is now always on; + `--(no-)experimental-multi-value` are kept for CLI compatibility but have + no effect (#6266). + ## 1.12.0 (2026-07-30) * motoko (`moc`) diff --git a/docs/languages/motoko/reference/language-manual.md b/docs/languages/motoko/reference/language-manual.md index a2fd748a..96f1b52f 100644 --- a/docs/languages/motoko/reference/language-manual.md +++ b/docs/languages/motoko/reference/language-manual.md @@ -363,9 +363,10 @@ The syntax of an **import** `` is as follows: "ic:" Import external actor by "canister:" Import external actor by "blob:file:" Import literal `Blob` value from + "idl:" Import types-only module from Candid ``` -An import introduces a resource referring to a local source module, module from a package of modules, a canister imported as an actor, or a literal [`Blob`](#type-blob) value. The contents of the resource are bound to ``. +An import introduces a resource referring to a local source module, module from a package of modules, a canister imported as an actor, a types-only module from a Candid IDL file, or a literal [`Blob`](#type-blob) value. The contents of the resource are bound to ``. Though typically a simple identifier, ``, `` can also be any composite pattern binding selective components of the resource. @@ -1362,6 +1363,8 @@ In detail, if `` is of the form: - `"blob:file:"` then `` is bound to a blob containing the contents of the file ``. `` is interpreted relative to the absolute location of the enclosing file. For example, `import image "blob:file:/assets/image.jpg"` defines `image` as the blob with bytes from local file `./assets/image.jpg`. Unlike library imports, `` should include the file's extension, if any. +- `"idl:"` then `` is bound to a types-only Motoko module derived from the Candid IDL file at ``: type field `Self` is the service actor type, and each named Candid type declared in that file is exported (PascalCased when unambiguous). `` is interpreted relative to the absolute location of the enclosing file and should include the extension (typically `.did`). For example, `import S "idl:api/ledger.did"` defines `S` with `S.Self` and related type aliases. This import cannot be used to call methods; use `ic:` / `canister:` (or `actor "" : S.Self`) for a live reference. + The case sensitivity of file references depends on the host operating system so it is recommended not to distinguish resources by filename casing alone. When building multi-canister projects with the [IC SDK](https://github.com/dfinity/sdk), Motoko programs can typically import canisters by alias (e.g. `import C "canister:counter"`), without specifying low-level canister ids (e.g. `import C "ic:lg264-qjkae"`). The SDK tooling takes care of supplying the appropriate command-line arguments to the Motoko compiler.)