Releases: caffeinelabs/motoko
1.1.0
-
motoko (
moc)-
Warn on unreachable let-else (#5789).
-
bugfix: The source region for
do { ... }blocks now includes thedokeyword too (#5785). -
Omit
blob:*imports frommoc --print-deps(#5781). -
Split unused identifier warnings into separate warnings for shared and non-shared contexts:
M0194for general declarations,M0240for identifiers in shared pattern contexts (e.g.cinshared({caller = c})),M0198for unused fields in object patterns, andM0241for unused fields in shared patterns (e.g.callerinshared({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
What's Changed
- experimental: Null coalesce
??operator - feat: allows resolving local definitions for context-dot by @christoph-dfinity in #5731
- feat: introduce primitives
get/setCandidTypeLimitsby @ggreif in #5642
Full Changelog: 1.0.0...1.0.0-nullc-2
1.0.0
-
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
AnyorNon(#5634). -
Fixed the type instantiation hint to have the correct arity (#5634).
-
Improved type inference of the record update syntax (#5625).
-
New flag
--error-recoveryto 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 isAny) can now be solved by choosing the lower bound (Inthere) when it has no proper supertypes other thanAny.
This means that when choosing between exactly two solutions: the lower bound andAnyas the upper bound, the lower bound is chosen as the solution for the invariant type parameter (Uhere).
Symmetrically, with bounds likeNon <: U <: Nat(when the lower bound isNon), the upper bound (Nathere) is chosen when it has no proper subtypes other thanNon.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 : Inthas typeInt, which implies thatInt <: U <: Any.
SinceInthas no proper supertypes other thanAny, it can be chosen as the solution for the invariant type parameterU, resulting in the output type[var Int].However, note that if the function body was of type
Nat, it would not compile, becauseNatis a proper subtype ofInt(Nat <: Int).
In this case, there would be no principal solution withNat <: 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
returnin their body (#5615).
Avoids confusing errors likeBool does not have expected type Tonreturnexpressions. Should type check successfully now. -
Add warning
M0239that warns when binding a unit()value byletorvar(#5599). -
Use
selfparameter, notSelftype, 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)vsa.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, ...)vsmap.filter(...).
Does not warn for binaryM.equals(e1, e2)orM.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
implicitargument declarations (#5517). -
Experimental support for Mixins (#5459).
-
bugfix: importing of
blob:file:URLs in subdirectories should work now (#5507, #5569). -
bugfix: escape
composite_queryfields 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
Draft release created for testing purposes
0.16.3-implicits-26
What's Changed
Full Changelog: 0.16.3-implicits-25...0.16.3-implicits-26
0.16.3-implicits-25
What's Changed
Full Changelog: 0.16.3-implicits-24...0.16.3-implicits-25
0.16.3-implicits-24
Full Changelog: 0.16.3-implicits-23...0.16.3-implicits-24
0.16.3-implicits-23
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
Draft release created for testing purposes
0.16.3-implicits-21
Draft release created for testing purposes