Abstract cast for function without explicit return type #5913

kevinresol opened this Issue Dec 29, 2016 · 0 comments


None yet

2 participants


Not a regression, same behaviour since 3.2

Abstract casts for a function require explicit return type to work.

import haxe.ds.Option;

class Test {
  static function main() {
    var r:Recover<Bool> = function() return true; // fails: Bool should be haxe.ds.Option
    var r:Recover<Bool> = function():Bool return true; // works

abstract Recover<T>(Void->Option<T>) from Void->Option<T> {
  @:from public static function ofConst<T>(f:Void->T):Recover<T>
    return function () return Some(f());
@Simn Simn added this to the 4.0 milestone Jan 5, 2017
@Simn Simn self-assigned this Jan 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment