Page 1 of 1

strange error with generic constraints

PostPosted: Sat Jan 09, 2010 5:49 am
by gauthier
class B<of TFoo>
where TFoo must be Program, callable
def foo as int
f = TFoo(bar=10)
return f.bar


class Program
pro bar from var as int?
def main is shared
b = B<of Program>()
b.foo


fail to compile with:

Code: Select all
error: COBRA INTERNAL ERROR / InvalidCastException / Unable to cast object of type 'GenericParam' to type 'ClassOrStruct'.
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


note: just in case, no worry: using constructor and property assignation works ok

Re: strange error with generic constraints

PostPosted: Sun Jan 10, 2010 1:02 am
by Charles
Fixed. Thanks for the report.