Skip to content

Instantly share code, notes, and snippets.

@back2dos
Last active December 16, 2015 03:48
Show Gist options
  • Select an option

  • Save back2dos/5372178 to your computer and use it in GitHub Desktop.

Select an option

Save back2dos/5372178 to your computer and use it in GitHub Desktop.
Inference issue.
package ;
abstract Abstract<T>(T->Void) from (T->Void) {
function new(f:T->Void)
this = f;
}
class Example {
static function testAbstract(c:Abstract<haxe.ds.Option<Bool>>) { }
static function testFunction(c:haxe.ds.Option<Bool>->Void) { }
static function main() {
testFunction(function (x) $type(x));//haxe.ds.Option<Bool>
testFunction(function (x) x = None);//works
testAbstract(function (x) $type(x));//Unknown<0>
testAbstract(function (x) x = None);//Unknown identifier None
var f = function (x) { }
testAbstract(f);
$type(f);//haxe.ds.Option -> Bool
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment