ciscoheat/buddy

Comparison with Dynamic typing throws error

clarkjones opened this issue · 3 comments

Not sure how if the title correctly describes the issue but while trying to replicate a similar issue I'm seeing in Haxe 3.2 rc-1 I realized something like the following is failing in the 3.1.3.

 it("should pass", {
//test will pass if :Dynamic is removed
  var arr:Dynamic,
      fn;
  arr = new Array<String>();

  fn = function(){
    return arr;
  }
 trace(arr == fn()); //true
  arr.should.be(fn());
/*
throws:
 should pass (FAILED: Invalid call)
      @ /usr/lib/haxe/lib/buddy/0,17,0/buddy/internal/SuiteBuilder.hx:43
      @ /usr/lib/haxe/lib/buddy/0,17,0/buddy/internal/SuiteRunner.hx:179
*/
});

I'll try to post the 3.2 issue when I can although that may just be a bug in 3.2. It does throw the same error though.

Thanks, it was a problem with a type parameter. Will be fixed very soon!

Thank you, I tried looking into it myself and quickly found out I have a lot more to learn about macros.

On Mar 17, 2015, at 9:23 AM, Andreas notifications@github.com wrote:

Thanks, it was a problem with a type parameter. Will be fixed very soon!


Reply to this email directly or view it on GitHub #33 (comment).

Macro code gets messy very quickly... I should make an attempt to clean it up. Anyway, this is fixed now in version 0.17.1, but only in one direction I must say. So arr.should.be(fn()) will work because it is typed explicitly, but fn().should.be(arr) won't because the compiler hasn't inferred the type of fn() yet, so it won't use the should extensions for that variable.