Optional parameter not recognized

This forum is meant for questions and discussions about the X# language and tools
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

Optional parameter not recognized

Post 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
Attachments
UnitTests.zip
(2.82 MiB) Downloaded 74 times
User avatar
robert
Posts: 4523
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Optional parameter not recognized

Post by robert »

Mathias,

Which version of the compiler ?

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

Optional parameter not recognized

Post by Otto »

Same problem for me. 2.0.0.4 , the latest build
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

Optional parameter not recognized

Post by Kromi »

2.0.0.2
User avatar
robert
Posts: 4523
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

Optional parameter not recognized

Post by robert »

Otto,

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

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
Chris
Posts: 4913
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Optional parameter not recognized

Post 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
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

Optional parameter not recognized

Post 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
User avatar
Otto
Posts: 174
Joined: Wed Sep 30, 2015 6:22 pm

Optional parameter not recognized

Post by Otto »

Vulcan.NET
I'll also try to create an sample. Didn't work the first time...
User avatar
Chris
Posts: 4913
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Optional parameter not recognized

Post 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
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

Optional parameter not recognized

Post 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
Post Reply