Skip to content

Releases: caffeinelabs/motoko

1.1.0

16 Jan 14:09
a2357bc

Choose a tag to compare

  • motoko (moc)

    • Warn on unreachable let-else (#5789).

    • bugfix: The source region for do { ... } blocks now includes the do keyword too (#5785).

    • Omit blob:* imports from moc --print-deps (#5781).

    • Split unused identifier warnings into separate warnings for shared and non-shared contexts: M0194 for general declarations, M0240 for identifiers in shared pattern contexts (e.g. c in shared({caller = c})), M0198 for unused fields in object patterns, and M0241 for unused fields in shared patterns (e.g. caller in shared({caller})) (#5779).

    • Print type constructors using available type paths (#5698).

    • Make the type checker more lenient and continue accumulating typing errors, and try to produce the typed AST even with errors. Enabled only with a type recovery flag for the IDE (Serokell Grant 2 Milestone 3) (#5776).

    • Explain subtype failures (#5643).

    • Removes the Viper support (#5751).

    • Allows resolving local definitions for context-dot (#5731).

    Extends contextual-dot resolution to consider local definitions first, to make the following snippet type check. Local definitions take precedence over definitions that are in scope via modules.

    func first<A>(self : [A]) : A {
      return self[0]
    };
    assert [1, 2, 3].first() == 1
    • Add privileged primitive for setting Candid type table cutoff (#5642).

1.0.0-nullc-2

16 Dec 14:53
00bb412

Choose a tag to compare

1.0.0-nullc-2 Pre-release
Pre-release

What's Changed

  • experimental: Null coalesce ?? operator
  • feat: allows resolving local definitions for context-dot by @christoph-dfinity in #5731
  • feat: introduce primitives get/setCandidTypeLimits by @ggreif in #5642

Full Changelog: 1.0.0...1.0.0-nullc-2

1.0.0

11 Dec 09:16
fd16545

Choose a tag to compare

  • motoko (moc)

    • Shorter, simpler error messages for generic functions (#5650).
      The compiler now tries to point to the first problematic expression in the function call, rather than the entire function call with type inference details.
      Simple errors only mention closed types; verbose errors with unsolved type variables are only shown when necessary.

    • Improved error messages for context dot: only the receiver type variables are solved, remaining type variables stay unsolved, not solved to Any or Non (#5634).

    • Fixed the type instantiation hint to have the correct arity (#5634).

    • Fix for #5618 (compiling dotted awaits) (#5622).

    • Improved type inference of the record update syntax (#5625).

    • New flag --error-recovery to enable reporting of multiple syntax errors (#5632).

    • Improved solving and error messages for invariant type parameters (#5464).
      Error messages now include suggested type instantiations when there is no principal solution.

      Invariant type parameters with bounds like Int <: U <: Any (when the upper bound is Any) can now be solved by choosing the lower bound (Int here) when it has no proper supertypes other than Any.
      This means that when choosing between exactly two solutions: the lower bound and Any as the upper bound, the lower bound is chosen as the solution for the invariant type parameter (U here).
      Symmetrically, with bounds like Non <: U <: Nat (when the lower bound is Non), the upper bound (Nat here) is chosen when it has no proper subtypes other than Non.

      For example, the following code now compiles without explicit type arguments:

      import VarArray "mo:core/VarArray";
      let varAr = [var 1, 2, 3];
      let result = VarArray.map(varAr, func x = x : Int);

      This compiles because the body of func x = x : Int has type Int, which implies that Int <: U <: Any.
      Since Int has no proper supertypes other than Any, it can be chosen as the solution for the invariant type parameter U, resulting in the output type [var Int].

      However, note that if the function body was of type Nat, it would not compile, because Nat is a proper subtype of Int (Nat <: Int).
      In this case, there would be no principal solution with Nat <: U <: Any, and the error message would suggest:

      Hint: Add explicit type instantiation, e.g. <Nat, Nat>
      

      The suggested type instantiation can be used to fix the code:

      let result = VarArray.map<Nat, Nat>(varAr, func x = x);

      Note that the error message suggests only one possible solution, but there may be alternatives. In the example above, <Nat, Int> would also be a valid instantiation.

    • Fixes type inference of deferred funcs that use return in their body (#5615).
      Avoids confusing errors like Bool does not have expected type T on return expressions. Should type check successfully now.

    • Add warning M0239 that warns when binding a unit () value by let or var (#5599).

    • Use self parameter, not Self type, to enable contextual dot notation (#5574).

    • Add (caffeine) warning M0237 (#5588).
      Warns if explicit argument could have been inferred and omitted,
      e.g. a.sort(Nat.compare) vs a.sort().
      (allowed by default, warn with -W 0237).

    • Add (caffeine) warning M0236 (#5584).
      Warns if contextual dot notation could have been used,
      e.g. Map.filter(map, ...) vs map.filter(...).
      Does not warn for binary M.equals(e1, e2) or M.compareXXX(e1, e2).
      (allowed by default, warn with -W 0236).

    • Add (caffeine) deprecation code M0235 (#5583).
      Deprecates any public types and values with special doc comment
      /// @deprecated M0235.
      (allowed by default, warn with -W 0235).

    • Experimental support for implicit argument declarations (#5517).

    • Experimental support for Mixins (#5459).

    • bugfix: importing of blob:file: URLs in subdirectories should work now (#5507, #5569).

    • bugfix: escape composite_query fields on the Candid side, as it is a keyword (#5617).

    • bugfix: implement Candid spec improvements (#5504, #5543, #5505).
      May now cause rejection of certain type-incorrect Candid messages that were accepted before.

0.16.3-reserve-implicit-keyword

10 Dec 23:12
2d0fcfd

Choose a tag to compare

Pre-release

Draft release created for testing purposes

0.16.3-implicits-26

05 Dec 17:24
7260463

Choose a tag to compare

0.16.3-implicits-26 Pre-release
Pre-release

What's Changed

  • feat: Explanation for migration stable sub by @Kamirus in #5705

Full Changelog: 0.16.3-implicits-25...0.16.3-implicits-26

0.16.3-implicits-25

01 Dec 17:18
eeb1d43

Choose a tag to compare

0.16.3-implicits-25 Pre-release
Pre-release

What's Changed

  • feat: Short bimatch errors arg/ret wrong where possible by @Kamirus in #5650

Full Changelog: 0.16.3-implicits-24...0.16.3-implicits-25

0.16.3-implicits-24

27 Nov 20:41
ee1fbae

Choose a tag to compare

0.16.3-implicits-24 Pre-release
Pre-release
  • bug: Revert 'record when block expected error' by @Kamirus in #5690

Full Changelog: 0.16.3-implicits-23...0.16.3-implicits-24

0.16.3-implicits-23

19 Nov 09:46
affbbcd

Choose a tag to compare

0.16.3-implicits-23 Pre-release
Pre-release

Draft release created for testing purposes

  • --implicit-package now auto-imports libraries for explicit value references as well as implicits and contextual dot.

0.16.3-implicits-22

12 Nov 11:07
24590e8

Choose a tag to compare

0.16.3-implicits-22 Pre-release
Pre-release

Draft release created for testing purposes

  • Improved error messages for context dot: only the receiver type variables are solved, remaining type variables stay unsolved, not solved to Any or Non (#5634).

  • Fixed the type instantiation hint to have the correct arity (#5634).

  • Fix for #5618 (compiling dotted awaits) (#5622).

  • Improved type inference of the record update syntax (#5625).

0.16.3-implicits-21

05 Nov 17:37
0f727e5

Choose a tag to compare

0.16.3-implicits-21 Pre-release
Pre-release

Draft release created for testing purposes