Releases: caffeinelabs/motoko
1.10.0
-
motoko (
moc)-
feat: M0218 ("redundant
stablekeyword") now ships a machine-applicable edit, somops check --fixremoves the explicitstablekeyword on fields of apersistent actor(#6175). -
feat: Permitting destructuring patterns against actor types —
let { foo } = a,func g({foo} : actor T) {}, etc. (#6149). -
feat:
/// @deprecated M0235 <message>— the caffeine deprecation warning (M0235) can now carry a free-text message, rendered as anote:sub-diagnostic at every use site. M0154 free-text deprecation messages now render the same way (#6153). -
perf: Multi-value Wasm codegen is now on by default,
--no-experimental-multi-valueflag disables (if not desired) (#6165). -
bugfix: M0237 (implicit argument can be omitted) only fires now when the suggested removal preserves the same type instantiation. Previously the edit could be rejected (M0098) (#6166).
-
bugfix: M0236 dot-notation suggestion no longer fires for literal receivers — the
lit.f()rewrite could misparse (-1.1.isNaN()→-(1.1.isNaN())), mis-lex (0xff.absas a hex float), or fail to type-check when it lost a literal coercion (Blob.isEmpty("\00")→"\00".isEmpty()) (#6173). -
bugfix: M0236 dot-notation suggestion no longer fires when the receiver cannot be inferred or would infer to a different type causing the call to resolve to a different function (#6177).
-
bugfix: Implicit argument derivation now resolves type variables that occur only in a covariant result position (e.g. JSON-style decoders
Text -> ?T). Previously such a variable was solved toNone(bottom), so the implicit had to be passed explicitly (#6186). -
bugfix: Diagnostic columns now count Unicode codepoints (matching editor displays and
rustc), and JSON diagnostics gainbyte_start/byte_endfor encoding-independent edit anchors. Previouslymops check --fixover-deleted on multi-byte lines (e.g.Char.toNat32('京')trimmed the trailing)) (#6168).
-
1.9.0-m0237-fix
chore(deps): Bump DeterminateSystems/update-flake-lock from 5ba4a20ae…
1.9.0-m0236-fix
chore: drop misconfigured idl-mo-float32 fail test (#6170) Misconfigured since [#2297](https://github.com/caffeinelabs/motoko/pull/2297) (2021): `MOC-FLAG --actor-idl` points at `idl-mo-bad-method`, so it tests the M0160 snowman case, not float32. The duplication went unnoticed because `fancy_of_message` raised `Sys_error` on the secondary diagnostic's `.did` path, masking both tests' real output. Fixing the typo doesn't help: `moc` has supported the Candid `float32` type since the original M0153 case was written, so the corrected test no longer fails. Drop it. Split out of [#6168](https://github.com/caffeinelabs/motoko/pull/6168) for clean review. Co-authored-by: Cursor <cursoragent@cursor.com>
1.9.0
-
motoko (
moc)-
feat: Structural implicit derivation for records and tuples via
__recordand__tuplecombiners. Per-field results are lazy thunks, enabling short-circuiting for operations likecompare(#5903). -
feat:
--experimental-multi-valueflag enables function-level multi-value Wasm codegen. Off by default (#6113).
-
1.8.2
-
motoko (
moc)- bugfix: M0236 dot-notation suggestion no longer fires when the receiver argument is not already a postfix expression (e.g.
Nat.toText((x * a + b) % c)). The compiler used to print the suggestion as(<expr>).toText(...)but emit no machine-applicable edits, leavingmops check --fixwith nothing to do; suggesting(complex).f()overModule.f(complex)is also a debatable style change. Trivial-receiver cases (variables, literals, calls) are unaffected (#6144).
- bugfix: M0236 dot-notation suggestion no longer fires when the receiver argument is not already a postfix expression (e.g.
1.8.1
-
motoko (
moc)- bugfix: Split stable-signature compatibility error M0169 — the "previous version does not contain the stable variable required by the migration function" case now reports as new code M0263, leaving M0169 strictly for the "stable variable would be implicitly discarded" (data-loss) case. The two scenarios have different fixes and now have distinct codes (#6134).
1.8.0
-
motoko (
moc)-
feat: Implicit argument derivation — the compiler can derive implicit arguments from functions that themselves have implicit parameters (e.g.,
comparefor[Nat]fromArray.compare<Nat>+Nat.compare). Works transitively and is depth-limited via--implicit-derivation-depth(#5966). -
feat:
and-patterns —p1 and p2matches when both legs match, binding from both (#6049). -
bugfix: M0236 dot-notation auto-fix on unparenthesized single-argument calls (e.g.
List.reverse b) no longer rewrites them into a bare function reference (b.reverse), which silently turned a call into a no-op; the suggestion now producesb.reverse()(#6096).
-
1.7.0
-
motoko (
moc)-
feat: Add null-coalescing operator
??(#5722).
e1 ?? e2evaluates to the unwrapped contents ofe1whene1is?v,
otherwise toe2. The right-hand side is evaluated lazily (short-circuit).
For example,opt ?? defaultValuereplaces the verbose
switch opt { case (?v) v; case null defaultValue }.
The right-hand side may be a block (e.g.opt ?? { let x = 1; x }),
ado-block, or aPrim.trapfor fail-fast unwrapping. Because{ ... }
on the right is parsed as a block, a bare record literal must be wrapped
in extra braces or parentheses, e.g.opt ?? ({ x = 0 })or
opt ?? {{ x = 0 }}. -
perf: Compile enhanced multi-migration chains as per-step functions instead of one deeply-nested inlined expression, avoiding the wasm-function complexity limit hit by long chains (#6065).
-
bugfix: Preserve GC-only roots (blob deduplication table, migration functions list) across graph-copy upgrades, and defer actor type compatibility checks to
ICStableReadso enhanced multi-migration chains with multiple pending steps are accepted (#5993). -
bugfix: Clearer error when installing a Motoko canister over a non-Motoko or otherwise incompatible canister (#6044).
-
1.6.0
-
motoko (
moc)-
feat: expose caller attributes feature through primitives (#5970).
-
bugfix: Fix
moc.jsresolution of relative flag paths (e.g.--enhanced-migration,--actor-idl): resolve against the project root (via newsetProjectRootAPI) instead of the source file's directory, matching nativemocbehavior. The language server should callsetProjectRoot(path)before processing files (#6015).
-