forked from dfinity/motoko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
374 additions
and
12 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
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,58 @@ | ||
// @verify | ||
// import Array "mo:base/Array"; | ||
|
||
actor { | ||
|
||
var arr : [var Int] = [var 1, 2]; | ||
var f : Int = 2; | ||
var count : Int = 42; // let is not supported | ||
|
||
public func foo(): async Int { | ||
var vi_a : [Int] = (([1] : [Int]) : [Int]); | ||
var vm_a : [var Int] = [var 1, 2]; | ||
let li_a : [Bool] = [false]; | ||
let lm_a : [var Bool] = [var false]; | ||
// vi_a = [1, 2] | ||
vi_a := [1, 2]; | ||
// li_a := [1, 2]; // error | ||
vm_a := [var 42]; | ||
// lm_a := [1, 2]; // error | ||
|
||
return 42; | ||
}; | ||
|
||
public func baz1(): async [Int] { | ||
let r : [Int] = [1, 2]; | ||
return r; | ||
}; | ||
|
||
private func baz2(): [var Int] { | ||
let r : [var Int] = [var 1, 2]; | ||
return r; | ||
}; | ||
|
||
private func bar(): Int { | ||
let x : [Int] = [42, 24]; | ||
let y : [var Bool] = [var false]; | ||
y[0] := true; | ||
let z : Int = x[0] + x[1]; | ||
return x[1]; | ||
}; | ||
|
||
public func bar2(x: [Int]): async Int { | ||
assert:func x.size() == 2; | ||
let y : [var Bool] = [var false]; | ||
y[0] := true; | ||
let z : Int = x[0] + x[1]; | ||
return x[1]; | ||
}; | ||
|
||
public func inc() : async Int { | ||
arr[0] := arr[0] + 1; | ||
return arr[0] | ||
}; | ||
|
||
public func len(): async Int { | ||
return arr.size(); | ||
}; | ||
} |
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 @@ | ||
Parse warning: In macro $Inv, the following parameters were defined but not used: $Self ([email protected]) |
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,8 @@ | ||
array.mo:7.9-7.10: warning [M0194], unused identifier f (delete or rename to wildcard `_` or `_f`) | ||
array.mo:8.9-8.14: warning [M0194], unused identifier count (delete or rename to wildcard `_` or `_count`) | ||
array.mo:13.13-13.17: warning [M0194], unused identifier li_a (delete or rename to wildcard `_` or `_li_a`) | ||
array.mo:14.13-14.17: warning [M0194], unused identifier lm_a (delete or rename to wildcard `_` or `_lm_a`) | ||
array.mo:29.18-29.22: warning [M0194], unused identifier baz2 (delete or rename to wildcard `_` or `_baz2`) | ||
array.mo:34.18-34.21: warning [M0194], unused identifier bar (delete or rename to wildcard `_` or `_bar`) | ||
array.mo:38.11-38.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`) | ||
array.mo:46.11-46.12: warning [M0194], unused identifier z (delete or rename to wildcard `_` or `_z`) |
Oops, something went wrong.