odd failure in test block
Posted: Tue Apr 08, 2008 5:54 pm
I think this one might be more of a C# thing than something with cobra, but it's too subtle for my C# skills, so I'm hoping somebody else can explain it to me.
The following code fails to compile on both windows and mono:
Specifically, it doesn't like the static method that is being generated for the test. Remove the test block, and it's happy. Alternatively, use VAlign as the types for VAlign.top and _vAlign instead of IVAlign, and it's happy. Finally, rename vAlign to anything else, and it's happy.
Not that this is something that's too terribly difficult to work around, but I do find it puzzling.
The following code fails to compile on both windows and mono:
interface IVAlign
get value as dynamic?
class VAlign
implements IVAlign
shared
get top as IVAlign
return VAlign('top')
var _value as dynamic?
get value from var
def init(value as String)
_value = value
class Bob
var _vAlign as IVAlign?
pro vAlign from var
test
t = Bob()
t.vAlign = VAlign.top
assert t.vAlign.value == 'top'
class Program
shared
def main
t = Bob()
t.vAlign = VAlign.top
assert t.vAlign.value == 'top'
Specifically, it doesn't like the static method that is being generated for the test. Remove the test block, and it's happy. Alternatively, use VAlign as the types for VAlign.top and _vAlign instead of IVAlign, and it's happy. Finally, rename vAlign to anything else, and it's happy.
Not that this is something that's too terribly difficult to work around, but I do find it puzzling.