windjammer 0.48.0

A simple language inspired by Go, Ruby, and Elixir that transpiles to Rust - 80% of Rust's power with 20% of the complexity
Documentation
#![cfg(any(
    not(any(
        feature = "parser_tests",
        feature = "analyzer_tests",
        feature = "codegen_tests",
        feature = "interpreter_tests",
        feature = "conformance_tests",
        feature = "integration_tests",
    )),
    feature = "integration_tests",
))]

// Integration test for static method inference bug
// Verifies that constructors like new(), from_*(), zero() don't get &self

use std::path::PathBuf;

#[test]
#[cfg_attr(tarpaulin, ignore)]
fn test_static_method_inference() {
    let out_tmp = tempfile::tempdir().expect("tempdir");
    let wj_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
        .join("tests")
        .join("static_method_inference_test.wj");

    windjammer::build_project(
        &wj_path,
        out_tmp.path(),
        windjammer::CompilationTarget::Rust,
        false,
    )
    .expect("Failed to run windjammer compiler");

    // Read the generated Rust code
    // The file location depends on whether path stripping succeeded:
    // - Success: <output_dir>/static_method_inference_test.rs
    // - Failure: <output_dir>/wj/windjammer/tests/static_method_inference_test.rs
    let generated_code =
        std::fs::read_to_string(out_tmp.path().join("static_method_inference_test.rs"))
            .or_else(|_| {
                std::fs::read_to_string(
                    out_tmp
                        .path()
                        .join("wj")
                        .join("windjammer")
                        .join("tests")
                        .join("static_method_inference_test.rs"),
                )
            })
            .expect("Failed to read generated code (tried both possible paths)");

    // Verify static methods do NOT have &self
    assert!(
        generated_code.contains("pub fn new(x: f32, y: f32) -> Point"),
        "new() should not have &self parameter"
    );

    assert!(
        generated_code.contains("pub fn from_coords(x: f32, y: f32) -> Point"),
        "from_coords() should not have &self parameter"
    );

    assert!(
        generated_code.contains("pub fn zero() -> Point"),
        "zero() should not have &self parameter"
    );

    // Verify instance method DOES have &self
    assert!(
        generated_code.contains("pub fn distance(&self, other: Point) -> f32"),
        "distance() should have &self parameter"
    );

    // THE BUG: Grid::new() should NOT have &self even though it uses field names in struct literal
    assert!(
        generated_code.contains("pub fn new(width: i32, height: i32) -> Grid"),
        "Grid::new() should not have &self parameter (this is the bug!)"
    );

    // Note: Skipping rustc verification because generated code includes test decorators
    // and windjammer_runtime imports that require cargo build environment.
    // The function signature checks above are sufficient to verify correctness.
}