xsharp.eu • Optional parameter not recognized
Page 1 of 3

Optional parameter not recognized

Posted: Thu Aug 30, 2018 12:23 pm
by Kromi
Hi,

maybe I have found a problem with optional parameters.
Consider a class in a Vulcan.NET library with one constructor with two optional parameters, one of the parameter default values is cast:

Code: Select all

CLASS ClassWithCtor
	CONSTRUCTOR(name := NULL_STRING AS STRING, number := (INT)1 AS INT)
		RETURN		
END CLASS
Then code that calls that constructor with one one argument:

Code: Select all

LOCAL test := ClassWithCtor{"fancy"} AS ClassWithCtor
If this line calling the constructor is in a Vulcan.NET library it compiles without errors. If it is in an X# library I get this error:
'InheritedXsharp.ClassWithCtor{ STRING }' : no constructor that accepts these argument types VulcanReferencingXsharp

I have attached a demo solution.

Mathias

Optional parameter not recognized

Posted: Thu Aug 30, 2018 2:10 pm
by robert
Mathias,

Which version of the compiler ?

Robert

Optional parameter not recognized

Posted: Thu Aug 30, 2018 2:40 pm
by Otto
Same problem for me. 2.0.0.4 , the latest build

Optional parameter not recognized

Posted: Thu Aug 30, 2018 2:43 pm
by Kromi
2.0.0.2

Optional parameter not recognized

Posted: Thu Aug 30, 2018 2:51 pm
by robert
Otto,

Which dialect ? (Default parameters are handled differently in the Core dialect then in VO/Vulcan).

Robert

Optional parameter not recognized

Posted: Thu Aug 30, 2018 11:17 pm
by Chris
Guys,

I am afraid I can't reproduce the problem. Matthias, do you mean that you get an error when trying to use the X# class from a vulcan library? Or from another X# library? In the solution you provided, I see the class and the code calling it defined in the same .prg file and it compiles ok here.

Can you please give some more info?

Chris

Optional parameter not recognized

Posted: Fri Aug 31, 2018 5:49 am
by Kromi
Hi Chris,

I placed two calls in the solution. The one you found works here, too. The second one is in the Vulcan-Project "VulcanReferencingXsharp", and this one gives the compiler error.

Do you not get that error when you compile the hole solution?

Mathias

Optional parameter not recognized

Posted: Fri Aug 31, 2018 6:42 am
by Otto
Vulcan.NET
I'll also try to create an sample. Didn't work the first time...

Optional parameter not recognized

Posted: Fri Aug 31, 2018 9:05 am
by Chris
Hi Kromi,
Kromi wrote:Hi Chris,

I placed two calls in the solution. The one you found works here, too. The second one is in the Vulcan-Project "VulcanReferencingXsharp", and this one gives the compiler error.

Do you not get that error when you compile the hole solution?

Mathias
I do not have vulcan installed in VS, so I could not test this, but tried the same scenario in XIDE and it worked without errors. Maybe it has to do with compiler options, will try to replicate the same and try again.

But in any case, is this scenario important for you, to use a X# dll from a vulcan project?

Chris

Optional parameter not recognized

Posted: Fri Aug 31, 2018 9:20 am
by Kromi
Hi Chris,

the scenario is important for me because I'm evaluating the transition of a huge Vulcan.NET solution to X#. Since I get some errors from the X# compiler that I can't resolve yet (e. g. calls to CCALLNATIVE) in a base project, my plan was to reset this project back to Vulcan.NET in order to be able to evaluate other projects that depend on the base project.

Mathias