diff --git a/.sources/VERSIONS b/.sources/VERSIONS index 73828996..6566f991 100644 --- a/.sources/VERSIONS +++ b/.sources/VERSIONS @@ -38,5 +38,5 @@ # appear in docs before they ship to users. # ------------------------------------------------------- -motoko v1.15.1 1f6fc15 +motoko v1.16.0 a2d0b69 internetidentity release-2026-08-28 583ad166 diff --git a/.sources/motoko b/.sources/motoko index 1f6fc156..a2d0b69d 160000 --- a/.sources/motoko +++ b/.sources/motoko @@ -1 +1 @@ -Subproject commit 1f6fc15658bfb169d9b72d462cbefee2259add34 +Subproject commit a2d0b69d23af9b9dbb70aa4cfffc91a59e1afa74 diff --git a/docs/languages/motoko/base-core-migration.md b/docs/languages/motoko/base-core-migration.md index 70bf783b..b9e05710 100644 --- a/docs/languages/motoko/base-core-migration.md +++ b/docs/languages/motoko/base-core-migration.md @@ -546,7 +546,7 @@ import Iter "mo:base/Iter"; persistent actor{ stable var mapEntries : [(Text, Nat)] = []; - let map = HashMap.fromIter(mapEntries.vals(), 10, Text.equal, Text.hash); + let map = HashMap.fromIter(mapEntries.values(), 10, Text.equal, Text.hash); system func preupgrade() { mapEntries := Iter.toArray(map.entries()); @@ -585,7 +585,7 @@ import Iter "mo:core/Iter"; ) : { map : Map.Map; } = { - map = Map.fromIter(state.mapEntries.vals(), Text.compare); + map = Map.fromIter(state.mapEntries.values(), Text.compare); } ) persistent actor{ @@ -699,7 +699,7 @@ persistent actor{ }; public query func getItems() : async [Item] { - Iter.toArray(textSet.vals(set)); + Iter.toArray(textSet.values(set)); }; }; ``` @@ -722,7 +722,7 @@ import Iter "mo:core/Iter"; } { let compare = Text.compare; let textSet = OrderedSet.Make(compare); - let set = Set.fromIter(textSet.vals(state.set), compare); + let set = Set.fromIter(textSet.values(state.set), compare); { set }; } ) @@ -825,7 +825,7 @@ import Iter "mo:base/Iter"; persistent actor{ stable var mapEntries : [(Text, Nat)] = []; - let map = TrieMap.fromEntries(mapEntries.vals(), Text.equal, Text.hash); + let map = TrieMap.fromEntries(mapEntries.values(), Text.equal, Text.hash); system func preupgrade() { mapEntries := Iter.toArray(map.entries()); @@ -929,7 +929,7 @@ import TrieSet "mo:base/TrieSet"; ) : { set : Set.Set; } = { - set = Set.fromIter(TrieSet.toArray(state.set).vals(), Text.compare); + set = Set.fromIter(TrieSet.toArray(state.set).values(), Text.compare); } ) persistent actorApp { diff --git a/docs/languages/motoko/fundamentals/control-flow/basic-control-flow.md b/docs/languages/motoko/fundamentals/control-flow/basic-control-flow.md index 563988f8..80b22892 100644 --- a/docs/languages/motoko/fundamentals/control-flow/basic-control-flow.md +++ b/docs/languages/motoko/fundamentals/control-flow/basic-control-flow.md @@ -33,7 +33,7 @@ Consider this function that computes the product of an array of integers. ```motoko no-repl func product(numbers : [Int]) : Int { var prod : Int = 1; - for (number in numbers.vals()) { + for (number in numbers.values()) { prod *= number; }; prod; // The implicit result of the block and function @@ -47,7 +47,7 @@ However, `prod` will remain `0` once it becomes `0` so you can save some work by ```motoko no-repl func product(numbers : [Int]) : Int { var prod : Int = 1; - for (number in numbers.vals()) { + for (number in numbers.values()) { prod *= number; if (prod == 0) return 0; // an early return can save work }; @@ -60,7 +60,7 @@ This also works with asynchronous functions that produce futures: ```motoko no-repl func asyncProduct(numbers : [Int]) : async Int { var prod : Int = 1; - for (number in numbers.vals()) { + for (number in numbers.values()) { prod *= number; if (prod == 0) return 0; // an early return completes the future }; @@ -152,7 +152,7 @@ Indeed, you can think of `return` as a `break` from the enclosing function. ```motoko no-repl func product(numbers : [Int]) : Int { var prod : Int = 1; - label l for (number in numbers.vals()) { + label l for (number in numbers.values()) { prod *= number; if (prod == 0) break l; }; @@ -166,7 +166,7 @@ If the block produces a non-`()` result, as in this minor refactoring, the `brea func product(numbers : [Int]) : Int { label result : Int { var prod : Int = 1; - for (number in numbers.vals()) { + for (number in numbers.values()) { prod *= number; if (prod == 0) break result 0; }; @@ -233,7 +233,7 @@ import Debug "mo:core/Debug"; import Nat "mo:core/Nat"; let numbers = [0, 1, 2, 3, 4]; -for (num in numbers.vals()) { +for (num in numbers.values()) { Debug.print(Nat.toText(num)); } ``` @@ -249,7 +249,7 @@ For example, computing the product we can skip a multiplication when the number ```motoko no-repl func product(numbers : [Int]) : Int { var prod : Int = 1; - for (number in numbers.vals()) { + for (number in numbers.values()) { if (number == 1) continue; prod *= number; }; @@ -262,7 +262,7 @@ When you have nested loops and need to continue a specific outer loop, you can u ```motoko no-repl func product(numbers : [Int]) : Int { var prod : Int = 1; - label l for (number in numbers.vals()) { + label l for (number in numbers.values()) { if (number == 1) continue l; prod *= number; }; diff --git a/docs/languages/motoko/fundamentals/control-flow/loops.md b/docs/languages/motoko/fundamentals/control-flow/loops.md index 58ed6e91..58a8c9f9 100644 --- a/docs/languages/motoko/fundamentals/control-flow/loops.md +++ b/docs/languages/motoko/fundamentals/control-flow/loops.md @@ -98,7 +98,7 @@ import Debug "mo:core/Debug"; let numbers = [0, 1, 2, 3, 4]; -for (num in numbers.vals()) { +for (num in numbers.values()) { Debug.print(debug_show(num)); }; ``` @@ -110,7 +110,7 @@ import Debug "mo:core/Debug"; let pairs = [(1, 2), (3, 4)]; -for ((fst, snd) in pairs.vals()) { +for ((fst, snd) in pairs.values()) { Debug.print(debug_show(fst + snd)); }; ``` diff --git a/docs/languages/motoko/fundamentals/implicit-parameters.md b/docs/languages/motoko/fundamentals/implicit-parameters.md index aa882ec9..9cfe6218 100644 --- a/docs/languages/motoko/fundamentals/implicit-parameters.md +++ b/docs/languages/motoko/fundamentals/implicit-parameters.md @@ -320,7 +320,7 @@ import Order "mo:core/Order"; // __record combiner: fold field-wise Order values, short-circuiting at first non-equal. // Thunks enable genuine short-circuiting — remaining fields are never evaluated. func compare(__record : [(Text, () -> Order.Order)]) : Order.Order { - for ((_, ordThunk) in __record.vals()) { + for ((_, ordThunk) in __record.values()) { let ord = ordThunk(); if (ord != #equal) return ord }; @@ -366,7 +366,7 @@ Each per-element implicit has type `(ElemType_i, ElemType_i) -> E`. This enables // __tuple combiner: join per-element descriptions (evaluates all thunks) func describe(__tuple : [() -> Text]) : Text { var s = "("; var first = true; - for (t in __tuple.vals()) { + for (t in __tuple.values()) { if (not first) { s #= ", " }; s #= t(); first := false }; diff --git a/docs/languages/motoko/fundamentals/types/advanced-types.md b/docs/languages/motoko/fundamentals/types/advanced-types.md index eed45d7a..fea6dc0e 100644 --- a/docs/languages/motoko/fundamentals/types/advanced-types.md +++ b/docs/languages/motoko/fundamentals/types/advanced-types.md @@ -276,7 +276,7 @@ actor Publisher { }; public shared func publish(message : Text) : async () { - for (sub in subscribers.vals()) { + for (sub in subscribers.values()) { let subActor = actor(Principal.toText(sub)) : actor { notify : (Text) -> async () }; await subActor.notify(message); }; diff --git a/docs/languages/motoko/fundamentals/types/function-types.md b/docs/languages/motoko/fundamentals/types/function-types.md index 3c73ab2e..2c34361d 100644 --- a/docs/languages/motoko/fundamentals/types/function-types.md +++ b/docs/languages/motoko/fundamentals/types/function-types.md @@ -321,7 +321,7 @@ A collection of values can be passed as a single array argument. ```motoko no-repl public func sum(numbers : [Nat]) : async Nat { var total : Nat = 0; - for (num in numbers.vals()) { total += num }; + for (num in numbers.values()) { total += num }; total; } ``` diff --git a/docs/languages/motoko/fundamentals/types/mutable-arrays.md b/docs/languages/motoko/fundamentals/types/mutable-arrays.md index 45dbd793..75bfeed9 100644 --- a/docs/languages/motoko/fundamentals/types/mutable-arrays.md +++ b/docs/languages/motoko/fundamentals/types/mutable-arrays.md @@ -207,7 +207,7 @@ func createTicTacToeBoard() : [var [var Text]] { // Function to print the board func printBoard() { - for (row in board.vals()) { + for (row in board.values()) { let rowText = Array.foldLeft(Array.freeze(row), "", func(acc, cell) = acc # cell # " "); Debug.print(rowText) } diff --git a/docs/languages/motoko/fundamentals/types/type-conversions.md b/docs/languages/motoko/fundamentals/types/type-conversions.md index de5b9220..d4877b0b 100644 --- a/docs/languages/motoko/fundamentals/types/type-conversions.md +++ b/docs/languages/motoko/fundamentals/types/type-conversions.md @@ -172,7 +172,7 @@ import Text "mo:core/Text"; persistent actor MapConverter { func arrayToMap(arr : [(Text, Nat)]) : HashMap.HashMap { let map = HashMap.HashMap(arr.size(), Text.equal, Text.hash); - for ((key, value) in arr.vals()) { + for ((key, value) in arr.values()) { map.put(key, value) }; map diff --git a/docs/languages/motoko/reference/changelog.md b/docs/languages/motoko/reference/changelog.md index 35347ada..b02c33c2 100644 --- a/docs/languages/motoko/reference/changelog.md +++ b/docs/languages/motoko/reference/changelog.md @@ -8,6 +8,38 @@ sidebar: # Motoko compiler changelog +## 1.16.0 (2026-09-09) + +* motoko (`moc`) + + * feat: warn (default-on, M0269) that `.vals()` is deprecated in favor of + `.values()` on arrays and Blob, and warn (default-on, M0270) that + `system func preupgrade`/`postupgrade` are deprecated in favor of the + persistent upgrade machinery. Silence with `-A=M0269` / `-A=M0270` + (#6347). + + * feat: add `Prim.costVetkdDeriveKey` for querying the cycle cost of the + IC `cost_vetkd_derive_key` system call, mirroring the existing + `costSignWithEcdsa`/`costSignWithSchnorr` primitives. It takes a `Text` + key name and a `Nat32` curve encoding and returns `(resultCode, costOrUndefined)`, + where a non-zero `resultCode` signals an invalid key name or curve + encoding, and `costOrUndefined` is the cost when `resultCode == 0` (#6353). + + * bugfix: `///` doc comments on members contributed to an actor via a + `mixin` `include` now appear in the generated Candid interface (`.did`), + matching the behavior for directly-declared members. Previously such + docs were silently dropped (#6351). + + * bugfix: The contextual dot suggestion (`M0236`) no longer proposes + rewriting `M.f(e, ...)` to `e.f(...)` when the rewrite would resolve + differently: the suggestion now validates the rewritten callee against + the actual dot resolution, so a same-named function field on the + receiver (including the built-in fields of arrays, blobs and text) + suppresses the suggestion (#6343). + + * bugfix: trap on array element counts that cannot be allocated, instead of + wrapping the byte size computed from them (#6312). + ## 1.15.1 (2026-09-02) * motoko (`moc`)