-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
2 changed files
with
28 additions
and
4 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
24 changes: 24 additions & 0 deletions
24
test/libponyc-run/promise-flatten-next-regression-3856/main.pony
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 @@ | ||
use "promises" | ||
|
||
actor FlattenNextProbe | ||
new create(handler: Handler iso) => | ||
let promise = Promise[String] | ||
// We need a call to next to be present with a call to flatten_next to trigger the issue during reachability analysis | ||
promise.next[Any tag](recover this~behaviour() end) | ||
(consume handler)(recover String end, promise) | ||
|
||
be behaviour(value: String) => | ||
None | ||
|
||
|
||
class Handler | ||
fun ref apply(line: String, prompt: Promise[String]) => | ||
let p = Promise[String] | ||
// BUG: Can't change the flatten_next | ||
p.flatten_next[String]({ (x: String) => Promise[String] }) | ||
|
||
|
||
actor Main | ||
new create(env: Env) => | ||
// BUG: Can't change this | ||
let term = FlattenNextProbe(Handler) |