OK, you're in luck. I have a reasonbly simple unit test for this. Will
post to github shortly.
-----------------------
package org.mirah.unit.test.ComplexConditional
#
# Std library support.
#
import java.lang.Object
import java.lang.String
import java.util.ArrayList
import java.util.HashMap
#####
#
# Demonstration type one.
#
class TypeOne
attr_reader val:int
def initialize
@val = 1
end
end
#####
#
# Demonstration type two.
#
class TypeTwo
attr_reader val:int
def initialize
@val = 2
end
end
#####
#
# Demonstration type three.
#
class TypeThree
attr_reader str:String
def initialize (str:String)
@str = str
end
end
#####
#
# Demonstration class for compiler issue.
#
class ComplexConditional
def initialize
@type1 = TypeOne(nil) # For type inference.
@type2 = TypeTwo(nil) # For type inference.
@type3 = TypeThree.new("Test Me!")
end
# Compiles, but Dalvik VM chokes on the byte code.
def case_01:boolean
if @type1 or @type2 or @type3.str.equals("__EMPTY__")
# If this line is called, the test FAILED.
result = false
else
# If this line is called, the test PASSED.
result = true
end
return result
end
# Compiles, Dalvik VM runs the byte code, but result is wrong.
def case_02:boolean
if (@type1 == TypeOne(nil)) or (@type2 == TypeTwo(nil)) or @type3.str.equals("__EMPTY__")
# If this line is called, the test FAILED.
result = false
else
# If this line is called, the test PASSED.
result = true
end
return result
end
# Compiles, runs correctly, but has redundant block.
def case_03:boolean
if @type1 or @type2
# If this line is called, the test FAILED.
result = false
elsif @type3.str.equals("__EMPTY__")
# If this line is called, the test FAILED.
result = false
else
# If this line is called, the test PASSED.
result = true
end
return result
end
end