-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error on non-primitive type in closure
- Loading branch information
Showing
14 changed files
with
131 additions
and
22 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,22 @@ | ||
active class Crop | ||
var v : Maybe[int] | ||
def init(v : Maybe[int]) : unit | ||
this.v = v | ||
end | ||
def collect() : Maybe[int] | ||
this.v | ||
end | ||
end | ||
active class Pepper | ||
def green(arg : Fut[Maybe[int]]) : Maybe[int] | ||
get(arg ~~> fun(x : Maybe[int]) : unit => forward((new Crop(x)) ! collect())) | ||
Nothing : Maybe[int] | ||
end | ||
end | ||
active class Main | ||
def main() : unit | ||
val arg = (new Crop((Just(42)))) ! collect() | ||
val tem = (new Pepper) ! green(arg) | ||
println("{}", get(tem)) | ||
end | ||
end |
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 @@ | ||
Just 42 |
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,31 @@ | ||
read class Mellon | ||
val v : int | ||
def init(v : int) : unit | ||
this. v = v | ||
end | ||
def grow() : int | ||
this.v | ||
end | ||
end | ||
active class Crop | ||
var v : Mellon | ||
def init(v : Mellon) : unit | ||
this.v = v | ||
end | ||
def collect() : Mellon | ||
this.v | ||
end | ||
end | ||
active class Pepper | ||
def green(arg : Fut[Mellon]) : Mellon | ||
(arg ~~> fun(x : Mellon) : unit => forward((new Crop(x)) ! collect())) | ||
new Mellon(42000000) -- Will be disregarded since it is used to bypass the typechecker. | ||
end | ||
end | ||
active class Main | ||
def main() : unit | ||
val mellon = new Mellon(42) | ||
val arg = (new Crop(mellon)) ! collect() | ||
println("{}", (get(arg)).grow()) | ||
end | ||
end |
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 @@ | ||
42 |
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,23 @@ | ||
active class Crop | ||
var v : String | ||
def init(v : String) : unit | ||
this.v = v | ||
end | ||
def collect() : String | ||
this.v | ||
end | ||
end | ||
active class Pepper | ||
def green(arg : Fut[String]) : String | ||
(arg ~~> fun(x : String) : unit => forward((new Crop(x)) ! collect())) | ||
"Will be disregarded since it is used to bypass the typechecker." | ||
end | ||
end | ||
|
||
active class Main | ||
def main() : unit | ||
val arg = (new Crop("42")) ! collect() | ||
val tem = (new Pepper) ! green(arg) | ||
println("{}", get(tem)) | ||
end | ||
end |
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 @@ | ||
42 |
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 @@ | ||
typedef Tuple = (int, real) | ||
|
||
active class Crop | ||
var v : Tuple | ||
def init(v : Tuple) : unit | ||
this.v = v | ||
end | ||
def collect() : Tuple | ||
this.v | ||
end | ||
end | ||
active class Pepper | ||
def green(arg : Fut[Tuple]) : Tuple | ||
(arg ~~> fun(x : Tuple) : unit => forward((new Crop(x)) ! collect())) | ||
(0, 0.0) -- Will be disregarded since it is used to bypass the typechecker. | ||
end | ||
end | ||
active class Main | ||
def main() : unit | ||
val arg = (new Crop((42, 42.0))) ! collect() | ||
val tem = (new Pepper) ! green(arg) | ||
println("{}", get(tem)) | ||
end | ||
end |
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 @@ | ||
(42, 42.000000) |
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
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