Skip to content

[TRACKER] PR #369 #378

@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

compiler refuses to use (plain) fields of constant structs. not sure if it counts as bug, but it is still inconvenient

Buggy Code

ivec2 :: struct {x, y : int;}

A :: ivec2.{1, 2};
B :: ivec2.{A.x, 1};
// "All values provided in a non-imperative struct literal must be constant, but argument 1 is not."
// "This struct literal is in a non-imperative scope, so it cannot contain elements that require runtime code."

main :: () {
	C :: ivec2.{A.x, 1};
	// "Declaration claims to be constant, but uses an expression that is not constant."
}

Workarounds

#run solves all the problems

Latest Test Outputs


windows
Compiler Error Output

In Workspace 2 ("Target Program"):
C:/Users/Private/Desktop/testo_runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/378_369_CEC0.jai:4,13: Error: All values provided in a non-imperative struct literal must be constant, but argument 1 is not.

    A :: ivec2.{1, 2};
    B :: ivec2.{A.x, 1};
                ^^^

C:/Users/Private/Desktop/testo_runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/378_369_CEC0.jai:4,11: Info: This struct literal is in a non-imperative scope, so it cannot contain elements that require runtime code.

    A :: ivec2.{1, 2};
    B :: ivec2.{A.x, 1};
              ^^^^^^^^^


linux
Compiler Error Output

In Workspace 2 ("Target Program"):
/home/ubuntu/Desktop/actions-runner/_work/JaiCommunityBugTrackerDev/JaiCommunityBugTrackerDev/compiler_bugs/378_369_CEC0.jai:9,2: Error: Declaration claims to be constant, but uses an expression that is not constant.

    main :: () {
    	C :: ivec2.{A.x, 1};
     ^^^^^^^^^^^^^^^^^^^



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