Closed kevinresol closed 8 years ago
It's the case null:
in switch array()
which doesn't result in a value for var s
. This should probably result in a compile error. I will look into it.
Oops, that piece of code was problematic. Try this instead
package;
using tink.CoreApi;
class Main implements await.Await{
public static function main() {
new Main();
}
public function new() {
bar().handle(function(o) trace(o.sure()));
}
@:async function bar() {
var s = switch outcome() {
case Success(s): s;
default:
var ret = null;
switch array() {
case null: // do nothing, leave `ret` as null
case v: for(a in v) ret = a;
}
ret;
}
var f = @:await foo();
return s == null ? 0 : Std.parseInt(f);
}
function array() return [for(i in 0...5) Std.string(i)];
function string() return "2";
function bool() return true;
function outcome() return Success('3');
@:async function foo() return '1';
}
I see, I'll get this fixed!
There were a few things going wrong here, which are addressed in 0.0.5. Switch cases that do not return a result when it's needed should also error now.
Awesome. seems working now. Thanks!
Not sure about the cause, but I isolated this piece of failing code as follow: