strange error with generic constraints
Posted: Sat Jan 09, 2010 5:49 am
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