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
2 changes: 1 addition & 1 deletion .sources/VERSIONS
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .sources/motoko
Submodule motoko updated 140 files
12 changes: 6 additions & 6 deletions docs/languages/motoko/base-core-migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ import Iter "mo:base/Iter";

persistent actor{
stable var mapEntries : [(Text, Nat)] = [];
let map = HashMap.fromIter<Text, Nat>(mapEntries.vals(), 10, Text.equal, Text.hash);
let map = HashMap.fromIter<Text, Nat>(mapEntries.values(), 10, Text.equal, Text.hash);

system func preupgrade() {
mapEntries := Iter.toArray(map.entries());
Expand Down Expand Up @@ -585,7 +585,7 @@ import Iter "mo:core/Iter";
) : {
map : Map.Map<Text, Nat>;
} = {
map = Map.fromIter(state.mapEntries.vals(), Text.compare);
map = Map.fromIter(state.mapEntries.values(), Text.compare);
}
)
persistent actor{
Expand Down Expand Up @@ -699,7 +699,7 @@ persistent actor{
};

public query func getItems() : async [Item] {
Iter.toArray(textSet.vals(set));
Iter.toArray(textSet.values(set));
};
};
```
Expand All @@ -722,7 +722,7 @@ import Iter "mo:core/Iter";
} {
let compare = Text.compare;
let textSet = OrderedSet.Make<App.Item>(compare);
let set = Set.fromIter(textSet.vals(state.set), compare);
let set = Set.fromIter(textSet.values(state.set), compare);
{ set };
}
)
Expand Down Expand Up @@ -825,7 +825,7 @@ import Iter "mo:base/Iter";

persistent actor{
stable var mapEntries : [(Text, Nat)] = [];
let map = TrieMap.fromEntries<Text, Nat>(mapEntries.vals(), Text.equal, Text.hash);
let map = TrieMap.fromEntries<Text, Nat>(mapEntries.values(), Text.equal, Text.hash);

system func preupgrade() {
mapEntries := Iter.toArray(map.entries());
Expand Down Expand Up @@ -929,7 +929,7 @@ import TrieSet "mo:base/TrieSet";
) : {
set : Set.Set<Text>;
} = {
set = Set.fromIter(TrieSet.toArray(state.set).vals(), Text.compare);
set = Set.fromIter(TrieSet.toArray(state.set).values(), Text.compare);
}
)
persistent actorApp {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
};
Expand All @@ -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
};
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down Expand Up @@ -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));
}
```
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions docs/languages/motoko/fundamentals/control-flow/loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -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));
};
```
Expand All @@ -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));
};
```
Expand Down
4 changes: 2 additions & 2 deletions docs/languages/motoko/fundamentals/implicit-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Text, Text>(Array.freeze<Text>(row), "", func(acc, cell) = acc # cell # " ");
Debug.print(rowText)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ import Text "mo:core/Text";
persistent actor MapConverter {
func arrayToMap(arr : [(Text, Nat)]) : HashMap.HashMap<Text, Nat> {
let map = HashMap.HashMap<Text, Nat>(arr.size(), Text.equal, Text.hash);
for ((key, value) in arr.vals()) {
for ((key, value) in arr.values()) {
map.put(key, value)
};
map
Expand Down
32 changes: 32 additions & 0 deletions docs/languages/motoko/reference/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down
Loading