X# version 2.0.0.9
Dialect Vulcan.NET
There seems to be a problem with optional parameters in the X#-Runtime. The value for an optional parameter is not set if you call a method from an untyped object.
Example:
Code: Select all
BEGIN NAMESPACE XSharpTests
FUNCTION Start() AS VOID STRICT
TestDefault()
TestDefaultCorrect()
FUNCTION TestDefault() AS VOID STRICT
LOCAL oTest := Test{}
oTest:TestMethod("Test") // wrong - 'optParam' is null
FUNCTION TestDefaultCorrect() AS VOID STRICT
LOCAL oTest := Test{} AS Test
oTest:TestMethod("Test") // ok - 'optParam' is empty string
CLASS Test
PUBLIC METHOD TestMethod(param AS STRING, optParam := "" AS STRING) AS LOGIC
IF optParam == ""
return .T.
ELSE
return .F.
ENDIF
END CLASS
END NAMESPACE
You will also find attached a simple console exe to reproduce this.
Regards
Thomas