Skip to content

[TRACKER] PR #358 #371

@jaibugbot

Description

@jaibugbot
Emailed In Reported Version Latest Broken Version Latest Broken Platforms Fix Version
beta-0.1.096 beta-0.2.010 windows, linux -

Description

can't overwrite macro arguments, when passed a constant

Buggy Code

#import "Basic";
#import "Compiler";

#run {
    set_build_options_dc(.{do_output = false});
    foo :: (y : int) #expand {
        print("%\n", y);
        y = 10;
        print("%\n", y);
    }
    x := 15;
    foo(x);
    print("%\n", x);        
    // prints 15, 10, 15, so i can assume that x and y are different variables
     
     
    foo :: (y : int) #expand {
        print("%\n", y);
        y = 10; // Error: Attempt to assign to a constant.
        print("%\n", y);
    }
    foo(15);
}

Workarounds

-

Latest Test Outputs


windows
Compiler Error Output

In Workspace 2 ("Target Program"):
C:/Users/Private/Desktop/testo_runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/371_358_CEC0.jai:12,5: Error: Identifier 'foo' is used here but is overloaded later, so it is being used before declared.

    }
    x := 15;
    foo(x);
    ^^^

C:/Users/Private/Desktop/testo_runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/371_358_CEC0.jai:17,5: Info: Here is the overload that is declared later.

    foo :: (y : int) #expand {
    ^^^^^^^^^^^^^^^^


linux
Compiler Error Output

In Workspace 2 ("Target Program"):
/home/ubuntu/Desktop/actions-runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/371_358_CEC0.jai:12,5: Error: Identifier 'foo' is used here but is overloaded later, so it is being used before declared.

    }
    x := 15;
    foo(x);
    ^^^

/home/ubuntu/Desktop/actions-runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/371_358_CEC0.jai:17,5: Info: Here is the overload that is declared later.

    foo :: (y : int) #expand {
    ^^^^^^^^^^^^^^^^



History V1

Version Windows Linux Mac
beta-0.2.010 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.009 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.008 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.007 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.006 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.005 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.004 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.003 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.002 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.2.001 ❌ - ExitCode 1 ❌ - ExitCode 1 -
beta-0.1.096 ❌ - ExitCode 1 ❌ - ExitCode 1 -

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions