fusionlanguage / fut

Fusion programming language. Transpiling to C, C++, C#, D, Java, JavaScript, Python, Swift, TypeScript and OpenCL C.
https://fusion-lang.org
GNU General Public License v3.0
1.77k stars 55 forks source link

Conditional compilation is broken #165

Closed Altair-sh closed 5 months ago

Altair-sh commented 5 months ago

The following code was transpiling fine with fut 3.1.1

public static class MainClass {
    public static void Main(string[] args){
        #if CS
        native {
            // some C# code
        }
        #endif
    }
}

Now fut produces following errors:

src/MainClass.fu(3): ERROR: Invalid expression
src/MainClass.fu(3): ERROR: Expected ';', got 'if'

The error can be avoided by removing the indent before #if.

public static class MainClass {
    public static void Main(string[] args){
#if CS
        //...

Please fix this or add a note in documentation about indentaion.

Altair-sh commented 5 months ago

I checked several fut versions and it seems this bug was added in 3.2.0

pfusik commented 5 months ago

Indeed, this was introduced in 3.2.0. Thanks for reporting!