-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refine static checks on migration function:
- Loading branch information
Showing
4 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import Prim "mo:prim"; | ||
|
||
// test migration function restrictions | ||
|
||
actor [()] a = { // reject, not a function | ||
}; | ||
|
||
actor [func <T>(x:T) : T {x}] b = { // reject, a generic function | ||
}; | ||
|
||
actor [func () : {} {{}}] c = { // reject, domain is not a record | ||
}; | ||
|
||
actor [func ({}) : () {}] d = { // reject, co-domain is not a record | ||
}; | ||
|
||
|
||
actor [func ({f:()->()}) : () {}] e = { // reject domain is unstable | ||
}; | ||
|
||
actor [func () : {f:()->()}{ {f = func(){}} }] | ||
f = { // reject, co-domain is unstable | ||
stable let f : Any = () | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
migration-bad.mo:5.8-5.10: type error [M0097], expected non-generic, local function type, but migration expression produces type | ||
() | ||
migration-bad.mo:8.8-8.29: type error [M0097], expected non-generic, local function type, but migration expression produces type | ||
<T>T -> T | ||
migration-bad.mo:11.8-11.25: type error [M0093], expected object type, but migration expression consumes non-object type | ||
() | ||
migration-bad.mo:14.8-14.25: type error [M0093], expected object type, but migration expression produces non-object type | ||
() | ||
migration-bad.mo:18.8-18.33: type error [M0093], expected object type, but migration expression produces non-object type | ||
() | ||
migration-bad.mo:18.8-18.33: type error [M0131], expected stable type, but migration expression consumes non-stable type | ||
{f : () -> ()} | ||
migration-bad.mo:21.8-21.46: type error [M0131], expected stable type, but migration expression produces non-stable type | ||
{f : () -> ()} | ||
migration-bad.mo:21.8-21.46: type error [M0093], expected object type, but migration expression consumes non-object type | ||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Return code 1 |