dibyendumajumdar / ravi

Ravi is a dialect of Lua, featuring limited optional static typing, JIT and AOT compilers
http://ravilang.github.io/
Other
1.16k stars 60 forks source link

Some AOT Issues. #244

Closed An0nyMooUS closed 2 years ago

An0nyMooUS commented 2 years ago

I really liked this AOT system, I intend to use it in my project.

For this, I will collaborate with some issues that I am discovering :)

function test()

  local myPlayer = getMyPlayer()

  -- if ( myPlayer:Alive() ) then <-- fail (Unexpected pseudo: T(0[0..]))
  -- if ( myPlayer:Alive() == true (or expression like (number, string))) ) then <-- works 

  if ( myPlayer:Alive() == true ) then -- works

  end 

end
dibyendumajumdar commented 2 years ago

Okay thank you for the report - I will look at what's happening.

dibyendumajumdar commented 2 years ago

I couldn't reproduce the issue.

This test works

function test()
  local myPlayer = getMyPlayer()
  if ( myPlayer:Alive() ) then
    return true
  end
  return false
end

function getMyPlayer()
    local player = {}
    function player:Alive()
        print 'called'
        return true
    end
    return player
end

assert(test())

Perhaps you get the failure in a wider context?

Ignore - I do see the issue

dibyendumajumdar commented 2 years ago

hi @An0nyMooUS I fixed the first issue. Re the second issue, I will need to have a look at a test case I can try out - hope you are able to provide.

Thank you for the bug report

An0nyMooUS commented 1 year ago

Unexpected pseudo:

if test:GetIsRight() then -- only works if ``== true`` explicitly.
   -- emit_op_cbr: Unexpected pseudo: T(1..)
end