Skip to content

Preprocessor defines are not accessible between includes #35

@mealet

Description

@mealet

👀 What Happened

I tried this code:

// lib.dn

#define PI 3.14

// main.dn

include "./lib.dn"

fn main() {
  println!("PI");
}

I expected to see this happen:
See output: 3.14

Instead, this happened:
Output is PI, so preprocessor didn't processed PI as a defined constant

⚡ Addition Info

Version: v1.2.0 fcd10643
Operating System: Arch Linux x86_64 (Linux 6.15.2-arch1-1)

LLVM IR Code

Not necessary

Intended solution

Keep global mutable preprocessor context between include modules and re-process files if definitions are changed (very bad and unefficient way, need to figure out better solution)

Metadata

Metadata

Assignees

No one assigned

    Labels

    compiler-bugCompiler's doing wrong things

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions