pr 66
This commit is contained in:
@@ -3,6 +3,7 @@ use std::path::PathBuf;
|
||||
use tempfile::tempdir;
|
||||
use prometeu_compiler::building::output::{compile_project, CompileError, ExportKey, ExportMetadata};
|
||||
use prometeu_compiler::building::plan::{BuildStep, BuildTarget};
|
||||
use prometeu_compiler::common::files::FileManager;
|
||||
use prometeu_compiler::deps::resolver::ProjectId;
|
||||
use prometeu_compiler::semantics::export_surface::ExportSurfaceKind;
|
||||
use prometeu_compiler::building::output::CompiledModule;
|
||||
@@ -58,7 +59,8 @@ fn test_local_vs_dependency_conflict() {
|
||||
deps,
|
||||
};
|
||||
|
||||
let result = compile_project(step, &dep_modules);
|
||||
let mut file_manager = FileManager::new();
|
||||
let result = compile_project(step, &dep_modules, &mut file_manager);
|
||||
|
||||
match result {
|
||||
Err(CompileError::DuplicateExport { symbol, .. }) => {
|
||||
@@ -136,7 +138,8 @@ fn test_aliased_dependency_conflict() {
|
||||
deps,
|
||||
};
|
||||
|
||||
let result = compile_project(step, &dep_modules);
|
||||
let mut file_manager = FileManager::new();
|
||||
let result = compile_project(step, &dep_modules, &mut file_manager);
|
||||
|
||||
match result {
|
||||
Err(CompileError::DuplicateExport { symbol, .. }) => {
|
||||
@@ -169,7 +172,8 @@ fn test_mixed_main_test_modules() {
|
||||
deps: BTreeMap::new(),
|
||||
};
|
||||
|
||||
let compiled = compile_project(step, &HashMap::new()).unwrap();
|
||||
let mut file_manager = FileManager::new();
|
||||
let compiled = compile_project(step, &HashMap::new(), &mut file_manager).unwrap();
|
||||
|
||||
// Both should be in exports with normalized paths
|
||||
assert!(compiled.exports.keys().any(|k| k.module_path == "math"));
|
||||
@@ -197,7 +201,8 @@ fn test_module_merging_same_directory() {
|
||||
deps: BTreeMap::new(),
|
||||
};
|
||||
|
||||
let compiled = compile_project(step, &HashMap::new()).unwrap();
|
||||
let mut file_manager = FileManager::new();
|
||||
let compiled = compile_project(step, &HashMap::new(), &mut file_manager).unwrap();
|
||||
|
||||
// Both should be in the same module "gfx"
|
||||
assert!(compiled.exports.keys().any(|k| k.module_path == "gfx" && k.symbol_name == "Gfx"));
|
||||
@@ -225,7 +230,8 @@ fn test_duplicate_symbol_in_same_module_different_files() {
|
||||
deps: BTreeMap::new(),
|
||||
};
|
||||
|
||||
let result = compile_project(step, &HashMap::new());
|
||||
let mut file_manager = FileManager::new();
|
||||
let result = compile_project(step, &HashMap::new(), &mut file_manager);
|
||||
assert!(result.is_err());
|
||||
// Should be a frontend error (duplicate symbol)
|
||||
}
|
||||
@@ -251,7 +257,8 @@ fn test_root_module_merging() {
|
||||
deps: BTreeMap::new(),
|
||||
};
|
||||
|
||||
let compiled = compile_project(step, &HashMap::new()).unwrap();
|
||||
let mut file_manager = FileManager::new();
|
||||
let compiled = compile_project(step, &HashMap::new(), &mut file_manager).unwrap();
|
||||
|
||||
// Both should be in the root module ""
|
||||
assert!(compiled.exports.keys().any(|k| k.module_path == "" && k.symbol_name == "Main"));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use prometeu_compiler::backend::emit_bytecode::emit_module;
|
||||
use prometeu_compiler::ir_core::ids::{ConstId as CoreConstId, FieldId, FunctionId, TypeId as CoreTypeId, ValueId};
|
||||
use prometeu_compiler::ir_core::{self, Block, ConstPool, ConstantValue, Instr, Program, Terminator};
|
||||
use prometeu_compiler::ir_core::{self, Block, ConstPool, ConstantValue, Instr, InstrKind as CoreInstrKind, Program, Terminator};
|
||||
use prometeu_compiler::ir_vm::InstrKind;
|
||||
use prometeu_compiler::lowering::lower_program;
|
||||
use std::collections::HashMap;
|
||||
@@ -37,22 +37,22 @@ fn test_hip_conformance_core_to_vm_to_bytecode() {
|
||||
id: 0,
|
||||
instrs: vec![
|
||||
// allocates a storage struct
|
||||
Instr::Alloc { ty: type_id, slots: 2 },
|
||||
Instr::SetLocal(0), // x = alloc
|
||||
Instr::from(CoreInstrKind::Alloc { ty: type_id, slots: 2 }),
|
||||
Instr::from(CoreInstrKind::SetLocal(0)), // x = alloc
|
||||
|
||||
// mutates a field
|
||||
Instr::BeginMutate { gate: ValueId(0) },
|
||||
Instr::PushConst(CoreConstId(0)),
|
||||
Instr::SetLocal(1), // v = 42
|
||||
Instr::GateStoreField { gate: ValueId(0), field: field_id, value: ValueId(1) },
|
||||
Instr::EndMutate,
|
||||
Instr::from(CoreInstrKind::BeginMutate { gate: ValueId(0) }),
|
||||
Instr::from(CoreInstrKind::PushConst(CoreConstId(0))),
|
||||
Instr::from(CoreInstrKind::SetLocal(1)), // v = 42
|
||||
Instr::from(CoreInstrKind::GateStoreField { gate: ValueId(0), field: field_id, value: ValueId(1) }),
|
||||
Instr::from(CoreInstrKind::EndMutate),
|
||||
|
||||
// peeks value
|
||||
Instr::BeginPeek { gate: ValueId(0) },
|
||||
Instr::GateLoadField { gate: ValueId(0), field: field_id },
|
||||
Instr::EndPeek,
|
||||
Instr::from(CoreInstrKind::BeginPeek { gate: ValueId(0) }),
|
||||
Instr::from(CoreInstrKind::GateLoadField { gate: ValueId(0), field: field_id }),
|
||||
Instr::from(CoreInstrKind::EndPeek),
|
||||
|
||||
Instr::Pop, // clean up the peeked value
|
||||
Instr::from(CoreInstrKind::Pop), // clean up the peeked value
|
||||
],
|
||||
terminator: Terminator::Return,
|
||||
}],
|
||||
|
||||
Reference in New Issue
Block a user