xsharp.eu • Error using Linq method
Page 1 of 1

Error using Linq method

Posted: Wed Apr 24, 2019 9:31 am
by Bernhard Mayer
Dear fellow X#'ers!

I just installed the latest FOX Bandol 2.0.1 version and did my usual initial test: Clean + Build the solution. The compiler now throws an error for a piece of code which has never been a problem before:

Code: Select all

 LOCAL languages AS IEnumerable<STRING>
languages := langIni:GetSection("POOL")
IF languages:ANY() // XS9002 Parser: unexpected input 'IF languages:ANY'
   result := languages:First()
ENDIF 
The proper using directives System.Collections.Generic and System.Linq are included in the source code file, so is the assembly reference System.Core. Changing the character casing of "ANY" to "Any" does not seem to make a difference either.

Any idea what I'm doing wrong?

Best regards,
Bernhard
Using VS 2017 Enterprise 15.9.4 with the Vulcan.NET dialect.

Error using Linq method

Posted: Wed Apr 24, 2019 10:17 am
by lumberjack
Hi Bernhard,
Bernhard Mayer wrote:Dear fellow X#'ers!
I just installed the latest FOX Bandol 2.0.1 version and did my usual initial test: Clean + Build the solution. The compiler now throws an error for a piece of code which has never been a problem before:

Code: Select all

 LOCAL languages AS IEnumerable<STRING>
languages := langIni:GetSection("POOL")
IF languages:@@ANY() // XS9002 Parser: unexpected input 'IF languages:ANY'
   result := languages:First()
ENDIF 
Any idea what I'm doing wrong?
Change to @@Any do the trick. It seems Vulcan dialect have "ANY" as a keyword. If you run the code under Core it will run unchanged.

Code: Select all

USING System
USING System.Collections.Generic
USING System.Linq
USING System.Text

FUNCTION Start() AS VOID
	LOCAL languages AS IEnumerable<STRING>
	languages := List<STRING>{<STRING>{"Lang1", "Lang2", "Lang3"}}
	LOCAL result AS LOGIC
	IF result := languages:Any() // No problem with Core
	ENDIF
	?result
RETURN

Error using Linq method

Posted: Wed Apr 24, 2019 11:00 am
by Bernhard Mayer
Thanks, it's working this way.
BR,
Bernhard