diff --git a/build.rs b/build.rs index f7d31437..d0d27f86 100644 --- a/build.rs +++ b/build.rs @@ -3,7 +3,6 @@ use clap::ValueEnum; use clap_complete::{generate_to, Shell}; use clap_complete_fig::Fig; use std::io::Error; -use std::path::Path; include!("src/driver/cli.rs"); @@ -21,29 +20,8 @@ fn generate_autocompletion() -> Result<(), Error> { Ok(()) } -/// Precompile the builtin module -fn compile_builtin_module() -> Result<(), Error> { - let ppl = Path::new("target/debug/ppl"); - if !ppl.exists() { - return Ok(()); - } - - let status = std::process::Command::new(ppl) - .args(&["compile", "src/runtime/ppl.ppl"]) - .args(&["--emit", "dynamic-library"]) - .args(&["--output-dir", "target/debug/deps"]) - .arg("--no-core") - .status()?; - - assert!(status.success()); - - Ok(()) -} - fn main() -> Result<(), Error> { generate_autocompletion()?; - compile_builtin_module()?; - Ok(()) } diff --git a/ppl/.gitignore b/ppl/.gitignore new file mode 100644 index 00000000..9d0a5ae6 --- /dev/null +++ b/ppl/.gitignore @@ -0,0 +1,2 @@ +# Ignore files generated by PPL compiler +**/target diff --git a/ppl/README.md b/ppl/README.md new file mode 100644 index 00000000..04ddc72d --- /dev/null +++ b/ppl/README.md @@ -0,0 +1 @@ +# PPL standard library diff --git a/src/runtime/ppl.ppl b/ppl/src/lib.ppl similarity index 100% rename from src/runtime/ppl.ppl rename to ppl/src/lib.ppl diff --git a/src/compilation/compiler.rs b/src/compilation/compiler.rs index 8e50a10e..a80ae24a 100644 --- a/src/compilation/compiler.rs +++ b/src/compilation/compiler.rs @@ -1,4 +1,7 @@ -use std::path::{Path, PathBuf}; +use std::{ + env::current_dir, + path::{Path, PathBuf}, +}; use indexmap::IndexMap; @@ -9,7 +12,7 @@ use crate::{ SourceFile, }; use log::{debug, trace}; -use miette::miette; +use miette::{bail, miette}; use super::{Package, PackageData}; @@ -89,22 +92,15 @@ pub struct Compiler { } impl Compiler { - /// Name of builtin module - pub const BUILTIN_MODULE_NAME: &'static str = "ppl"; - /// Directory of builtin module - pub const BUILTIN_MODULE_DIR: &'static str = - concat!(env!("CARGO_MANIFEST_DIR"), "/src/runtime"); - /// Path of builtin module - pub const BUILTIN_MODULE_PATH: &'static str = - concat!(env!("CARGO_MANIFEST_DIR"), "/src/runtime/ppl.ppl"); + /// Location of PPL package + pub const PPL_PACKAGE: &'static str = concat!(env!("CARGO_MANIFEST_DIR"), "/ppl"); /// Create new compiler with empty cache pub fn new() -> Self { - let path = Path::new(Self::BUILTIN_MODULE_DIR); - + let path = Path::new(Self::PPL_PACKAGE); let mut compiler = Compiler::without_builtin().at(path); - compiler.compile_package(Self::BUILTIN_MODULE_NAME).unwrap(); + compiler.compile_package("ppl").unwrap(); compiler.import_builtin = true; @@ -155,17 +151,13 @@ impl Compiler { /// Locate module by name /// /// # Module search order - /// 1. `{root}/{name}.ppl` - /// 2. `{root}/{name}/mod.ppl` + /// 1. `{root}/src/{name}.ppl` + /// 2. `{root}/src/{name}/mod.ppl` pub fn locate(&mut self, name: &str) -> miette::Result { - let variants = if name == Self::BUILTIN_MODULE_NAME { - vec![Self::BUILTIN_MODULE_PATH.into()] - } else { - vec![ - self.root.join(format!("{name}.ppl")), - self.root.join(name).join("mod.ppl"), - ] - }; + let variants = vec![ + self.root.join("src").join(format!("{name}.ppl")), + self.root.join("src").join(name).join("mod.ppl"), + ]; variants .iter() @@ -191,9 +183,9 @@ impl Compiler { /// Get compiled module from cache or compile it /// /// # Module search order - /// 1. `{root}/{name}.ppl` - /// 2. `{root}/{name}/mod.ppl` - fn compile(&mut self, name: &str) -> miette::Result { + /// 1. `{root}/src/{name}.ppl` + /// 2. `{root}/src/{name}/mod.ppl` + pub(crate) fn compile(&mut self, name: &str) -> miette::Result { let path = self.locate(name)?; let canonic_path = std::fs::canonicalize(&path).unwrap(); @@ -233,6 +225,28 @@ impl Compiler { Ok(module) } + fn locate_package(&mut self, package: &str) -> miette::Result { + if package == "ppl" { + return Ok(Self::PPL_PACKAGE.into()); + } + + let cwd = current_dir().unwrap(); + if cwd.is_dir() && cwd.ends_with(package) { + return Ok(cwd); + } + + let dep = cwd.join("dependencies").join(package); + if dep.is_dir() { + return Ok(dep); + } + + bail!( + "Package `{package}` not found in {} or {}", + cwd.display(), + dep.display() + ) + } + /// Get compiled package from cache or compile it pub fn compile_package(&mut self, package: &str) -> miette::Result { if let Some(index) = self.packages.get_index_of(package) { @@ -242,9 +256,13 @@ impl Compiler { let name = package.to_string(); let index = self.packages.len(); let package = Package::with_index(index); + let old_root = self.root.clone(); + let root = self.locate_package(&name)?; + self.root = root.clone(); self.packages.insert( name.clone(), PackageData { + root, name: name.clone(), modules: Default::default(), dependencies: Default::default(), @@ -252,8 +270,21 @@ impl Compiler { ); self.package_stack.push(package); - self.compile(&name)?; + let main = self.root.join("src/main.ppl"); + let lib = self.root.join("src/lib.ppl"); + if main.exists() { + self.compile("main")?; + } else if lib.exists() { + self.compile("lib")?; + } else { + bail!( + "No {main} or {lib} found in package `{name}`", + main = main.display(), + lib = lib.display() + ); + } self.package_stack.pop(); + self.root = old_root; Ok(package) } diff --git a/src/compilation/package.rs b/src/compilation/package.rs index 9ec32e50..e6868df7 100644 --- a/src/compilation/package.rs +++ b/src/compilation/package.rs @@ -1,4 +1,4 @@ -use std::collections::HashSet; +use std::{collections::HashSet, path::PathBuf}; use super::{Compiler, Module}; @@ -34,6 +34,8 @@ impl Package { pub struct PackageData { /// Name of the package pub name: String, + /// Root directory of the package + pub root: PathBuf, /// List of modules in the package pub modules: Vec, /// List of dependencies for this package diff --git a/src/driver/cli.rs b/src/driver/cli.rs index 1122335b..f6e69932 100644 --- a/src/driver/cli.rs +++ b/src/driver/cli.rs @@ -1,4 +1,4 @@ -use self::commands::{Build, Compile, New}; +use self::commands::{Build, New}; use clap::{Parser, Subcommand}; use derive_more::From; @@ -17,8 +17,6 @@ pub enum Command { New(New), /// Build package Build(Build), - /// Compile single ppl file - Compile(Compile), } pub mod commands { @@ -38,24 +36,13 @@ pub mod commands { /// Command to build a package #[derive(Parser, Debug)] - pub struct Build {} - - /// Command to compile single ppl file - #[derive(Parser, Debug)] - pub struct Compile { - /// File to compile - #[arg(value_name = "file")] - pub file: PathBuf, + pub struct Build { /// Directory where compiler output will be placed. - #[arg(long, value_name = "dir", default_value = ".")] + #[arg(long, value_name = "dir", default_value = "target")] pub output_dir: PathBuf, /// Output type of compilation #[arg(long = "emit", value_name = "output type")] pub output_type: Option, - /// Compile without core library. - /// Used for compiling core library itself. - #[arg(long, default_value = "false")] - pub no_core: bool, } pub mod compile { diff --git a/src/driver/execute/build.rs b/src/driver/execute/build.rs index cb38b71f..61d91ebd 100644 --- a/src/driver/execute/build.rs +++ b/src/driver/execute/build.rs @@ -1,7 +1,19 @@ +use std::{ + fs, + path::{Path, PathBuf}, +}; + use cmd_lib::run_cmd; +use log::{debug, trace}; use miette::{bail, miette}; +use tempdir::TempDir; -use crate::driver::commands::{compile::OutputType, Build, Compile}; +use crate::{ + compilation::{Compiler, Package}, + driver::commands::{compile::OutputType, Build}, + ir::HIRModuleLowering, + named::Named, +}; use super::Execute; @@ -11,38 +23,156 @@ impl Execute for Build { fn execute(&self) -> Self::Output { let cwd = std::env::current_dir().map_err(|e| miette!("{e}"))?; let package = cwd.file_name().unwrap().to_str().unwrap(); - let output_dir = cwd.join("target"); - let no_core = package == "ppl"; + let output_dir = self.output_dir.clone(); run_cmd!( mkdir -p $output_dir ) .map_err(|e| miette!("{e}"))?; - let main = cwd.join("src/main.ppl"); - if main.exists() { - use OutputType::*; - return Compile { - file: main, - output_dir, - output_type: Some(Executable), - no_core, - } - .execute(); + let output_type = if cwd.join("src/main.ppl").exists() { + OutputType::Executable + } else if cwd.join("src/lib.ppl").exists() { + OutputType::DynamicLibrary + } else { + bail!("No src/main.ppl or src/lib.ppl found at {}", cwd.display()); + }; + + let mut compiler = if package == "ppl" { + Compiler::without_builtin() + } else { + Compiler::new() + }; + let compiler = &mut compiler; + + let package = compiler.compile_package(package)?; + + let output_type = self.output_type.unwrap_or(output_type); + let dependencies_dir = output_dir.join("deps"); + run_cmd!( + mkdir -p $dependencies_dir + ) + .map_err(|e| miette!("{e}"))?; + + package.emit(compiler, output_dir, output_type, dependencies_dir)?; + + Ok(()) + } +} + +trait Emit { + fn emit( + &self, + compiler: &mut Compiler, + output_dir: PathBuf, + output_type: OutputType, + dependencies_dir: PathBuf, + ) -> miette::Result; +} + +impl Emit for Package { + fn emit( + &self, + compiler: &mut Compiler, + output_dir: PathBuf, + output_type: OutputType, + dependencies_dir: PathBuf, + ) -> miette::Result { + let name = &self.data(compiler).name; + let filename = output_type.named(name); + let output_file = output_dir.join(&filename); + + let dependencies = self.data(compiler).dependencies.clone(); + let dependencies: Vec<_> = dependencies + .iter() + .map(|package| { + package.emit( + compiler, + dependencies_dir.clone(), + OutputType::DynamicLibrary, + dependencies_dir.clone(), + ) + }) + .try_collect()?; + + let module = self.data(compiler).modules.first().unwrap().clone(); + if output_type == OutputType::HIR { + let hir = module.data(compiler).to_string(); + fs::write(&output_file, hir).map_err(|e| miette!("{output_file:?}: {e}"))?; + return Ok(output_file); } - let lib = cwd.join("src/lib.ppl"); - if lib.exists() { - use OutputType::*; - return Compile { - file: lib, - output_dir, - output_type: Some(DynamicLibrary), - no_core, - } - .execute(); + let with_main = output_type == OutputType::Executable; + + let llvm = inkwell::context::Context::create(); + let ir = module.data(compiler).to_ir(&llvm, with_main, module); + debug!(target: "ir", "{}", ir.to_string()); + if output_type == OutputType::IR { + fs::write(&output_file, ir.to_string()).map_err(|e| miette!("{output_file:?}: {e}"))?; + return Ok(output_file); + } + + let temp_dir = TempDir::new("ppl").unwrap(); + + let bitcode = temp_dir.path().join(filename).with_extension("bc"); + let path = module + .data(compiler) + .source_file() + .path() + .to_string_lossy() + .into_owned(); + trace!(target: "steps", "generating bitcode for {} => {}", path, bitcode.display()); + + ir.write_bitcode_to_path(&bitcode); + if output_type == OutputType::Bitcode { + std::fs::copy(bitcode, output_file.with_extension("bc")).unwrap(); + return Ok(output_file); + } + + let bitcodes: Vec<_> = self.data(compiler) + .modules + .iter() + .filter(|m| **m != module) + .map(|m| { + let compilation_module = m.clone(); + let m = m.data(compiler); + let llvm = inkwell::context::Context::create(); + let with_main = false; + let ir = m.to_ir(&llvm, with_main, compilation_module); + let filename = m.name().to_string(); + let bitcode = temp_dir.path().join(filename).with_extension("bc"); + trace!(target: "steps", "generating bitcode for {} => {}", m.source_file().path().to_string_lossy(), bitcode.display()); + ir.write_bitcode_to_path(&bitcode); + bitcode.to_string_lossy().to_string() + }) + .chain(std::iter::once(bitcode.to_string_lossy().to_string())) + .collect(); + + let mut clang = std::process::Command::new("clang"); + let lib_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("target/debug/deps"); + let lib = lib_path.to_str().unwrap(); + + match output_type { + OutputType::HIR => unreachable!("HIR is already written"), + OutputType::IR => unreachable!("IR is already written"), + OutputType::Bitcode => unreachable!("IR is already written"), + + OutputType::Object => clang.arg("-c"), + OutputType::Assembler => clang.arg("-S"), + OutputType::StaticLibrary => clang.args(&["-c", "-fPIC"]), + OutputType::DynamicLibrary => clang.arg("-dynamiclib"), + OutputType::Executable => &mut clang, } + .args(&["-L", lib, "-lruntime"]) + .args(&bitcodes) + .args(dependencies) + .args(&["-o", output_file.to_str().unwrap()]) + .arg("-Wno-override-module") + .arg("-g") + .arg("-fsanitize=address") + .status() + .map_err(|e| miette!("{output_file:?}: {e}"))?; - bail!("No src/main.ppl or src/lib.ppl found at {}", cwd.display()); + Ok(output_file) } } diff --git a/src/driver/execute/compile.rs b/src/driver/execute/compile.rs deleted file mode 100644 index d49bd578..00000000 --- a/src/driver/execute/compile.rs +++ /dev/null @@ -1,165 +0,0 @@ -use std::fs; -use std::path::{Path, PathBuf}; - -use crate::compilation::Package; -use crate::driver::commands::compile::OutputType; -use crate::ir::HIRModuleLowering; -use crate::named::Named; -use crate::{compilation::Compiler, driver::commands::Compile}; -use cmd_lib::run_cmd; -use log::{debug, trace}; -use miette::miette; -use tempdir::TempDir; - -use super::Execute; - -impl Execute for Compile { - type Output = miette::Result<()>; - - /// Compile single ppl file - fn execute(&self) -> Self::Output { - let mut compiler = if self.no_core { - Compiler::without_builtin() - } else { - Compiler::new() - } - .at(self.file.parent().unwrap()); - let compiler = &mut compiler; - - let name = self.file.file_stem().map(|n| n.to_str()).flatten().unwrap(); - let package = compiler.compile_package(name)?; - - let output_type = self.output_type.unwrap_or(OutputType::Executable); - let dependencies_dir = self.output_dir.join("deps"); - run_cmd!( - mkdir -p $dependencies_dir - ) - .map_err(|e| miette!("{e}"))?; - - package.emit( - compiler, - self.output_dir.clone(), - output_type, - dependencies_dir, - )?; - - Ok(()) - } -} - -trait Emit { - fn emit( - &self, - compiler: &mut Compiler, - output_dir: PathBuf, - output_type: OutputType, - dependencies_dir: PathBuf, - ) -> miette::Result; -} - -impl Emit for Package { - fn emit( - &self, - compiler: &mut Compiler, - output_dir: PathBuf, - output_type: OutputType, - dependencies_dir: PathBuf, - ) -> miette::Result { - let name = &self.data(compiler).name; - let filename = output_type.named(name); - let output_file = output_dir.join(&filename); - - let dependencies = self.data(compiler).dependencies.clone(); - let dependencies: Vec<_> = dependencies - .iter() - .map(|package| { - package.emit( - compiler, - dependencies_dir.clone(), - OutputType::DynamicLibrary, - dependencies_dir.clone(), - ) - }) - .try_collect()?; - - let module = self.data(compiler).modules.first().unwrap().clone(); - if output_type == OutputType::HIR { - let hir = module.data(compiler).to_string(); - fs::write(&output_file, hir).map_err(|e| miette!("{output_file:?}: {e}"))?; - return Ok(output_file); - } - - let with_main = output_type == OutputType::Executable; - - let llvm = inkwell::context::Context::create(); - let ir = module.data(compiler).to_ir(&llvm, with_main, module); - debug!(target: "ir", "{}", ir.to_string()); - if output_type == OutputType::IR { - fs::write(&output_file, ir.to_string()).map_err(|e| miette!("{output_file:?}: {e}"))?; - return Ok(output_file); - } - - let temp_dir = TempDir::new("ppl").unwrap(); - - let bitcode = temp_dir.path().join(filename).with_extension("bc"); - let path = module - .data(compiler) - .source_file() - .path() - .to_string_lossy() - .into_owned(); - trace!(target: "steps", "generating bitcode for {} => {}", path, bitcode.display()); - - ir.write_bitcode_to_path(&bitcode); - if output_type == OutputType::Bitcode { - std::fs::copy(bitcode, output_file.with_extension("bc")).unwrap(); - return Ok(output_file); - } - - let bitcodes: Vec<_> = self.data(compiler) - .modules - .iter() - .filter(|m| **m != module) - .map(|m| { - let compilation_module = m.clone(); - let m = m.data(compiler); - let llvm = inkwell::context::Context::create(); - let with_main = false; - let ir = m.to_ir(&llvm, with_main, compilation_module); - let filename = m.name().to_string(); - let bitcode = temp_dir.path().join(filename).with_extension("bc"); - trace!(target: "steps", "generating bitcode for {} => {}", m.source_file().path().to_string_lossy(), bitcode.display()); - ir.write_bitcode_to_path(&bitcode); - bitcode.to_string_lossy().to_string() - }) - .chain(std::iter::once(bitcode.to_string_lossy().to_string())) - .collect(); - - let mut clang = std::process::Command::new("clang"); - let lib_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("target/debug/deps"); - let lib = lib_path.to_str().unwrap(); - - match output_type { - OutputType::HIR => unreachable!("HIR is already written"), - OutputType::IR => unreachable!("IR is already written"), - OutputType::Bitcode => unreachable!("IR is already written"), - - OutputType::Object => clang.arg("-c"), - OutputType::Assembler => clang.arg("-S"), - OutputType::StaticLibrary => clang.args(&["-c", "-fPIC"]), - OutputType::DynamicLibrary => clang.arg("-dynamiclib"), - OutputType::Executable => &mut clang, - } - .args(&["-L", lib, "-lruntime"]) - .args(&bitcodes) - .args(dependencies) - .args(&["-o", output_file.to_str().unwrap()]) - .arg("-Wno-override-module") - .arg("-g") - .arg("-fsanitize=address") - .status() - .map_err(|e| miette!("{output_file:?}: {e}"))?; - - Ok(output_file) - } -} diff --git a/src/driver/execute/mod.rs b/src/driver/execute/mod.rs index d651f83c..ec9da21f 100644 --- a/src/driver/execute/mod.rs +++ b/src/driver/execute/mod.rs @@ -1,5 +1,4 @@ mod build; -mod compile; mod new; use super::Command; @@ -18,7 +17,6 @@ impl Execute for Command { fn execute(&self) -> Self::Output { match self { - Command::Compile(compile) => compile.execute(), Command::New(new) => new.execute(), Command::Build(build) => build.execute(), } diff --git a/src/driver/mod.rs b/src/driver/mod.rs index 582df09d..0f154bf1 100644 --- a/src/driver/mod.rs +++ b/src/driver/mod.rs @@ -6,6 +6,3 @@ pub use execute::Execute; pub use cli::commands; pub use cli::Command; - -#[cfg(test)] -mod tests; diff --git a/src/driver/tests/mod.rs b/src/driver/tests/mod.rs deleted file mode 100644 index caa3dbbe..00000000 --- a/src/driver/tests/mod.rs +++ /dev/null @@ -1,3 +0,0 @@ -use crate::e2e; - -e2e!(multifile); diff --git a/src/e2e.rs b/src/e2e.rs index 7f67632d..0095f52a 100644 --- a/src/e2e.rs +++ b/src/e2e.rs @@ -10,7 +10,7 @@ macro_rules! e2e { use tempdir::TempDir; // Compile-time check that file exists - include_bytes!(concat!(stringify!($name), "/", stringify!($name), ".ppl")); + include_bytes!(concat!(stringify!($name), "/src/main.ppl")); let temp_dir = TempDir::new("ppl").unwrap(); let file = file!(); @@ -56,9 +56,8 @@ pub mod internal { let temp_dir_path = temp_dir.path().to_str().unwrap(); let ppl = concat!(env!("CARGO_MANIFEST_DIR"), "/target/debug/ppl"); - let file = format!("{name}.ppl"); let output = std::process::Command::new(ppl) - .args(&["compile", &file]) + .args(&["build"]) .args(&["--output-dir", temp_dir_path]) .current_dir(dir) .output() @@ -74,9 +73,8 @@ pub mod internal { pub fn hir(temp_dir: &TempDir, name: &str, dir: &Path) -> String { let ppl = concat!(env!("CARGO_MANIFEST_DIR"), "/target/debug/ppl"); - let file = format!("{name}.ppl"); std::process::Command::new(ppl) - .args(&["compile", &file]) + .args(&["build"]) .args(&["--output-dir", temp_dir.path().to_str().unwrap()]) .args(&["--emit", "hir"]) .current_dir(dir) @@ -90,9 +88,8 @@ pub mod internal { pub fn ir(temp_dir: &TempDir, name: &str, dir: &Path) -> String { let ppl = concat!(env!("CARGO_MANIFEST_DIR"), "/target/debug/ppl"); - let file = format!("{name}.ppl"); std::process::Command::new(ppl) - .args(&["compile", &file]) + .args(&["build"]) .args(&["--output-dir", temp_dir.path().to_str().unwrap()]) .args(&["--emit", "ir"]) .current_dir(dir) diff --git a/src/ir/mod.rs b/src/ir/mod.rs index 422f3bfe..ec79a471 100644 --- a/src/ir/mod.rs +++ b/src/ir/mod.rs @@ -14,6 +14,3 @@ mod context; pub use context::*; pub(crate) mod inkwell; - -#[cfg(test)] -mod tests; diff --git a/src/ir/tests/mod.rs b/src/ir/tests/mod.rs deleted file mode 100644 index 6eb20b58..00000000 --- a/src/ir/tests/mod.rs +++ /dev/null @@ -1,7 +0,0 @@ -use crate::e2es; - -e2es! { - clone, - empty_constructor, - type_of -} diff --git a/src/semantics/mod.rs b/src/semantics/mod.rs index 43dcac0a..a26cf1e8 100644 --- a/src/semantics/mod.rs +++ b/src/semantics/mod.rs @@ -31,6 +31,3 @@ pub use implicit::*; mod destructors; pub use destructors::*; - -#[cfg(test)] -mod tests; diff --git a/src/semantics/tests/mod.rs b/src/semantics/tests/mod.rs deleted file mode 100644 index c2bc4870..00000000 --- a/src/semantics/tests/mod.rs +++ /dev/null @@ -1,32 +0,0 @@ -use crate::e2es; - -e2es! { - array, - candidate_not_viable, - constraints, - constraints_in_constructor, - deref_member_ref, - destructor, - generics, - import_all, - integer, - integer_not_eq_rational, - memory, - missing_fields, - monomorphize, - monomorphize_predeclared, - multiple_errors, - multiple_initialization, - non_class_constructor, - plus_assign, - predeclare_function, - predeclare_vars, - rational, - reference_mut, - references, - specify_variable_ty, - string, - traits, - type_as_value, - wrong_initializer_type -} diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.run.snap deleted file mode 100644 index 04c2962f..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__memory.run.snap deleted file mode 100644 index a5947dad..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.run.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -0 -1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.run.snap deleted file mode 100644 index 745dd77a..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -true diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize_predeclared.error.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize_predeclared.error.snap deleted file mode 100644 index fab9cb2c..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize_predeclared.error.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: err ---- -Error: × Main thread panicked. - ├─▶ at src/ir/to_ir.rs:482:21 - ╰─▶ Generic function fn predeclared -> None has no - definition, inside this call: predeclared 1 - help: set the `RUST_BACKTRACE=1` environment variable to display a - backtrace. -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! -THIS SHOULD GIVE ERROR UNTILL IT IS FIXED!!! diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.run.snap deleted file mode 100644 index efa94da2..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -4 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.run.snap deleted file mode 100644 index 04c2962f..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.run.snap deleted file mode 100644 index e10f7bbd..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.run.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -1 -2 -2 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__references.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__references.run.snap deleted file mode 100644 index a5947dad..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__references.run.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -0 -1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.run.snap b/src/semantics/tests/snapshots/ppl__semantics__tests__traits.run.snap deleted file mode 100644 index 04c2962f..00000000 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/semantics/tests/mod.rs -expression: run_log ---- -1 diff --git a/src/semantics/to_hir.rs b/src/semantics/to_hir.rs index 331e3a97..527ebb44 100644 --- a/src/semantics/to_hir.rs +++ b/src/semantics/to_hir.rs @@ -749,14 +749,25 @@ impl ToHIR for ast::Use { let compiler = context.compiler_mut(); - let package_name = self.path.first().unwrap().as_str(); - let package = compiler.compile_package(package_name).unwrap(); - - let current_package = compiler.current_package(); - current_package - .data_mut(compiler) - .dependencies - .insert(package.clone()); + let first_part = self.path.first().unwrap().as_str(); + let module = if compiler.locate(first_part).is_ok() { + compiler.compile(first_part).unwrap() + } else { + let package = compiler.compile_package(first_part).unwrap(); + + let current_package = compiler.current_package(); + current_package + .data_mut(compiler) + .dependencies + .insert(package.clone()); + + package + .data(context.compiler()) + .modules + .first() + .unwrap() + .clone() + }; let name = self.path.last().unwrap().as_str(); @@ -764,13 +775,6 @@ impl ToHIR for ast::Use { let mut variables = IndexMap::new(); let mut types = IndexMap::new(); - let module = package - .data(context.compiler()) - .modules - .first() - .unwrap() - .clone(); - let module = module.data(context.compiler()); let imported_item: hir::ImportedItem = if name == "*" { functions = module.functions.clone(); diff --git a/src/snapshots/ppl__e2e__internal__error.log.snap b/src/snapshots/ppl__e2e__internal__error.log.snap deleted file mode 100644 index 07be98e2..00000000 --- a/src/snapshots/ppl__e2e__internal__error.log.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/e2e.rs -expression: stderr ---- - diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 03f94323..59dfc62f 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -23,6 +23,3 @@ pub use parse::*; mod precedence; pub use precedence::*; - -#[cfg(test)] -mod tests; diff --git a/src/syntax/tests/mod.rs b/src/syntax/tests/mod.rs deleted file mode 100644 index ffb25ffb..00000000 --- a/src/syntax/tests/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -use crate::e2es; - -e2es! { - common_functions, - consume_greater, - empty_block, - escaped_id, - invalid_indentation, - multiple_errors, - star -} diff --git a/src/syntax/tests/multiple_errors/multiple_errors.ppl b/src/syntax/tests/multiple_errors/multiple_errors.ppl deleted file mode 100644 index 75e10779..00000000 --- a/src/syntax/tests/multiple_errors/multiple_errors.ppl +++ /dev/null @@ -1,2 +0,0 @@ -let x 1 -if \ No newline at end of file diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.run.snap b/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.run.snap deleted file mode 100644 index 171c793b..00000000 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/syntax/tests/mod.rs -expression: run_log ---- - diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.run.snap b/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.run.snap deleted file mode 100644 index 171c793b..00000000 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/syntax/tests/mod.rs -expression: run_log ---- - diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__multiple_errors.error.snap b/src/syntax/tests/snapshots/ppl__syntax__tests__multiple_errors.error.snap deleted file mode 100644 index 7fc47dce..00000000 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__multiple_errors.error.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: src/syntax/tests/mod.rs -expression: err ---- -Error: lexer::unexpected_token - - × expected `=`, got `integer` - ╭─[multiple_errors.ppl:1:7] - 1 │ let x 1 - · ─ - 2 │ if - ╰──── -parser::missing_expression - - × missing expression - ╭─[multiple_errors.ppl:2:3] - 1 │ let x 1 - 2 │ if - ╰──── diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__star.run.snap b/src/syntax/tests/snapshots/ppl__syntax__tests__star.run.snap deleted file mode 100644 index 2db2bdc9..00000000 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__star.run.snap +++ /dev/null @@ -1,5 +0,0 @@ ---- -source: src/syntax/tests/mod.rs -expression: run_log ---- -6 diff --git a/src/semantics/tests/array/array.ppl b/src/tests/array/src/main.ppl similarity index 100% rename from src/semantics/tests/array/array.ppl rename to src/tests/array/src/main.ppl diff --git a/src/semantics/tests/candidate_not_viable/candidate_not_viable.ppl b/src/tests/candidate_not_viable/src/main.ppl similarity index 100% rename from src/semantics/tests/candidate_not_viable/candidate_not_viable.ppl rename to src/tests/candidate_not_viable/src/main.ppl diff --git a/src/ir/tests/clone/clone.ppl b/src/tests/clone/src/main.ppl similarity index 100% rename from src/ir/tests/clone/clone.ppl rename to src/tests/clone/src/main.ppl diff --git a/src/syntax/tests/common_functions/common_functions.ppl b/src/tests/common_functions/src/main.ppl similarity index 100% rename from src/syntax/tests/common_functions/common_functions.ppl rename to src/tests/common_functions/src/main.ppl diff --git a/src/semantics/tests/constraints/constraints.ppl b/src/tests/constraints/src/main.ppl similarity index 100% rename from src/semantics/tests/constraints/constraints.ppl rename to src/tests/constraints/src/main.ppl diff --git a/src/semantics/tests/constraints_in_constructor/constraints_in_constructor.ppl b/src/tests/constraints_in_constructor/src/main.ppl similarity index 100% rename from src/semantics/tests/constraints_in_constructor/constraints_in_constructor.ppl rename to src/tests/constraints_in_constructor/src/main.ppl diff --git a/src/syntax/tests/consume_greater/consume_greater.ppl b/src/tests/consume_greater/src/main.ppl similarity index 100% rename from src/syntax/tests/consume_greater/consume_greater.ppl rename to src/tests/consume_greater/src/main.ppl diff --git a/src/tests/deps/dependencies/helper/src/lib.ppl b/src/tests/deps/dependencies/helper/src/lib.ppl new file mode 100644 index 00000000..8baa54e2 --- /dev/null +++ b/src/tests/deps/dependencies/helper/src/lib.ppl @@ -0,0 +1 @@ +fn say hello => println "Hello, World!" \ No newline at end of file diff --git a/src/tests/deps/src/main.ppl b/src/tests/deps/src/main.ppl new file mode 100644 index 00000000..d205efde --- /dev/null +++ b/src/tests/deps/src/main.ppl @@ -0,0 +1,3 @@ +use helper.* + +say hello diff --git a/src/semantics/tests/deref_member_ref/deref_member_ref.ppl b/src/tests/deref_member_ref/src/main.ppl similarity index 100% rename from src/semantics/tests/deref_member_ref/deref_member_ref.ppl rename to src/tests/deref_member_ref/src/main.ppl diff --git a/src/semantics/tests/destructor/destructor.ppl b/src/tests/destructor/src/main.ppl similarity index 100% rename from src/semantics/tests/destructor/destructor.ppl rename to src/tests/destructor/src/main.ppl diff --git a/src/syntax/tests/empty_block/empty_block.ppl b/src/tests/empty_block/src/main.ppl similarity index 100% rename from src/syntax/tests/empty_block/empty_block.ppl rename to src/tests/empty_block/src/main.ppl diff --git a/src/ir/tests/empty_constructor/empty_constructor.ppl b/src/tests/empty_constructor/src/main.ppl similarity index 100% rename from src/ir/tests/empty_constructor/empty_constructor.ppl rename to src/tests/empty_constructor/src/main.ppl diff --git a/src/syntax/tests/escaped_id/escaped_id.ppl b/src/tests/escaped_id/src/main.ppl similarity index 100% rename from src/syntax/tests/escaped_id/escaped_id.ppl rename to src/tests/escaped_id/src/main.ppl diff --git a/src/semantics/tests/generics/generics.ppl b/src/tests/generics/src/main.ppl similarity index 100% rename from src/semantics/tests/generics/generics.ppl rename to src/tests/generics/src/main.ppl diff --git a/src/semantics/tests/import_all/import_all.ppl b/src/tests/import_all/src/main.ppl similarity index 78% rename from src/semantics/tests/import_all/import_all.ppl rename to src/tests/import_all/src/main.ppl index dee4243e..635df21d 100644 --- a/src/semantics/tests/import_all/import_all.ppl +++ b/src/tests/import_all/src/main.ppl @@ -1,4 +1,4 @@ -use lib.* +use utils.* println (do nothing) println (do something) \ No newline at end of file diff --git a/src/semantics/tests/import_all/lib.ppl b/src/tests/import_all/src/utils.ppl similarity index 100% rename from src/semantics/tests/import_all/lib.ppl rename to src/tests/import_all/src/utils.ppl diff --git a/src/semantics/tests/integer/integer.ppl b/src/tests/integer/src/main.ppl similarity index 100% rename from src/semantics/tests/integer/integer.ppl rename to src/tests/integer/src/main.ppl diff --git a/src/semantics/tests/integer_not_eq_rational/integer_not_eq_rational.ppl b/src/tests/integer_not_eq_rational/src/main.ppl similarity index 100% rename from src/semantics/tests/integer_not_eq_rational/integer_not_eq_rational.ppl rename to src/tests/integer_not_eq_rational/src/main.ppl diff --git a/src/syntax/tests/invalid_indentation/invalid_indentation.ppl b/src/tests/invalid_indentation/src/main.ppl similarity index 100% rename from src/syntax/tests/invalid_indentation/invalid_indentation.ppl rename to src/tests/invalid_indentation/src/main.ppl diff --git a/src/semantics/tests/memory/memory.ppl b/src/tests/memory/src/main.ppl similarity index 100% rename from src/semantics/tests/memory/memory.ppl rename to src/tests/memory/src/main.ppl diff --git a/src/semantics/tests/missing_fields/missing_fields.ppl b/src/tests/missing_fields/src/main.ppl similarity index 100% rename from src/semantics/tests/missing_fields/missing_fields.ppl rename to src/tests/missing_fields/src/main.ppl diff --git a/src/tests/mod.rs b/src/tests/mod.rs index 61d70614..a2d17c6b 100644 --- a/src/tests/mod.rs +++ b/src/tests/mod.rs @@ -1,3 +1,44 @@ use crate::e2es; -e2es!(supertraits); +e2es! { + array, + candidate_not_viable, + clone, + common_functions, + constraints, + constraints_in_constructor, + consume_greater, + deps, + deref_member_ref, + destructor, + empty_block, + empty_constructor, + escaped_id, + generics, + import_all, + integer, + integer_not_eq_rational, + invalid_indentation, + memory, + missing_fields, + monomorphize, + monomorphize_predeclared, + multifile, + multiple_errors, + multiple_initialization, + non_class_constructor, + plus_assign, + predeclare_function, + predeclare_vars, + rational, + reference_mut, + references, + specify_variable_ty, + star, + string, + supertraits, + traits, + type_as_value, + type_of, + wrong_initializer_type +} diff --git a/src/semantics/tests/monomorphize/monomorphize.ppl b/src/tests/monomorphize/src/main.ppl similarity index 100% rename from src/semantics/tests/monomorphize/monomorphize.ppl rename to src/tests/monomorphize/src/main.ppl diff --git a/src/semantics/tests/monomorphize_predeclared/monomorphize_predeclared.ppl b/src/tests/monomorphize_predeclared/src/main.ppl similarity index 100% rename from src/semantics/tests/monomorphize_predeclared/monomorphize_predeclared.ppl rename to src/tests/monomorphize_predeclared/src/main.ppl diff --git a/src/driver/tests/multifile/greet.ppl b/src/tests/multifile/src/greet.ppl similarity index 100% rename from src/driver/tests/multifile/greet.ppl rename to src/tests/multifile/src/greet.ppl diff --git a/src/driver/tests/multifile/multifile.ppl b/src/tests/multifile/src/main.ppl similarity index 100% rename from src/driver/tests/multifile/multifile.ppl rename to src/tests/multifile/src/main.ppl diff --git a/src/semantics/tests/multiple_errors/multiple_errors.ppl b/src/tests/multiple_errors/src/main.ppl similarity index 100% rename from src/semantics/tests/multiple_errors/multiple_errors.ppl rename to src/tests/multiple_errors/src/main.ppl diff --git a/src/semantics/tests/multiple_initialization/multiple_initialization.ppl b/src/tests/multiple_initialization/src/main.ppl similarity index 100% rename from src/semantics/tests/multiple_initialization/multiple_initialization.ppl rename to src/tests/multiple_initialization/src/main.ppl diff --git a/src/semantics/tests/non_class_constructor/non_class_constructor.ppl b/src/tests/non_class_constructor/src/main.ppl similarity index 100% rename from src/semantics/tests/non_class_constructor/non_class_constructor.ppl rename to src/tests/non_class_constructor/src/main.ppl diff --git a/src/semantics/tests/plus_assign/plus_assign.ppl b/src/tests/plus_assign/src/main.ppl similarity index 100% rename from src/semantics/tests/plus_assign/plus_assign.ppl rename to src/tests/plus_assign/src/main.ppl diff --git a/src/semantics/tests/predeclare_function/predeclare_function.ppl b/src/tests/predeclare_function/src/main.ppl similarity index 100% rename from src/semantics/tests/predeclare_function/predeclare_function.ppl rename to src/tests/predeclare_function/src/main.ppl diff --git a/src/semantics/tests/predeclare_vars/predeclare_vars.ppl b/src/tests/predeclare_vars/src/main.ppl similarity index 100% rename from src/semantics/tests/predeclare_vars/predeclare_vars.ppl rename to src/tests/predeclare_vars/src/main.ppl diff --git a/src/semantics/tests/rational/rational.ppl b/src/tests/rational/src/main.ppl similarity index 100% rename from src/semantics/tests/rational/rational.ppl rename to src/tests/rational/src/main.ppl diff --git a/src/semantics/tests/reference_mut/reference_mut.ppl b/src/tests/reference_mut/src/main.ppl similarity index 100% rename from src/semantics/tests/reference_mut/reference_mut.ppl rename to src/tests/reference_mut/src/main.ppl diff --git a/src/semantics/tests/references/references.ppl b/src/tests/references/src/main.ppl similarity index 100% rename from src/semantics/tests/references/references.ppl rename to src/tests/references/src/main.ppl diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__array.hir.snap b/src/tests/snapshots/ppl__tests__array.hir.snap similarity index 90% rename from src/semantics/tests/snapshots/ppl__semantics__tests__array.hir.snap rename to src/tests/snapshots/ppl__tests__array.hir.snap index 7eb697b5..d8c00ca8 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__array.hir.snap +++ b/src/tests/snapshots/ppl__tests__array.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let mut arr: Array = (Type:Type) [ ] diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__array.ir.snap b/src/tests/snapshots/ppl__tests__array.ir.snap similarity index 98% rename from src/semantics/tests/snapshots/ppl__semantics__tests__array.ir.snap rename to src/tests/snapshots/ppl__tests__array.ir.snap index aac74e91..29522a36 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__array.ir.snap +++ b/src/tests/snapshots/ppl__tests__array.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'array' -source_filename = "array.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/array/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -135,7 +135,7 @@ return: ; preds = %1 ret %Integer %3 } -define void @array.execute() !dbg !20 { +define void @main.execute() !dbg !20 { init_globals: call void @initialize(), !dbg !21 call void @initialize.1(), !dbg !22 @@ -423,7 +423,7 @@ declare %String @integer_as_string(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "array.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/array/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -441,7 +441,7 @@ declare %String @integer_as_string(%Integer) !17 = !DILocation(line: 6, column: 14, scope: !16) !18 = distinct !DISubprogram(name: "size of <:Type>", linkageName: "size of <:Type>", scope: !16, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !19 = !DILocation(line: 6, column: 14, scope: !18) -!20 = distinct !DISubprogram(name: "array.execute", linkageName: "array.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!20 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !21 = !DILocation(line: 6, column: 14, scope: !20) !22 = !DILocation(line: 0, column: 14, scope: !20) !23 = !DILocation(line: 2, column: 9, scope: !20) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__array.run.snap b/src/tests/snapshots/ppl__tests__array.run.snap similarity index 56% rename from src/semantics/tests/snapshots/ppl__semantics__tests__array.run.snap rename to src/tests/snapshots/ppl__tests__array.run.snap index bd1e7cd2..0e3fda8a 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__array.run.snap +++ b/src/tests/snapshots/ppl__tests__array.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- Empty diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__candidate_not_viable.error.snap b/src/tests/snapshots/ppl__tests__candidate_not_viable.error.snap similarity index 92% rename from src/semantics/tests/snapshots/ppl__semantics__tests__candidate_not_viable.error.snap rename to src/tests/snapshots/ppl__tests__candidate_not_viable.error.snap index cd9c6749..9e13a305 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__candidate_not_viable.error.snap +++ b/src/tests/snapshots/ppl__tests__candidate_not_viable.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::no_function × no operator `<:Rational> + <:Integer>` - ╭─[candidate_not_viable.ppl:1:1] + ╭─[main.ppl:1:1] 1 │ 0.1 + 2 · ─┬─ ┬ ┬ · │ │ ╰── <:Integer> @@ -19,7 +19,7 @@ Advice: ☞ candidate is not viable × expected `Integer` type, got `Rational` Error: × Integer - ╭─[ppl.ppl:88:5] + ╭─[lib.ppl:88:5] 87 │ @mangle_as("integer_plus_integer") 88 │ fn <:Integer> + <:Integer> -> Integer · ▲ @@ -34,7 +34,7 @@ Advice: ☞ candidate is not viable × expected `Rational` type, got `Integer` Error: × Rational - ╭─[ppl.ppl:152:19] + ╭─[lib.ppl:152:19] 151 │ @mangle_as("rational_plus_rational") 152 │ fn <:Rational> + <:Rational> -> Rational · ▲ @@ -49,7 +49,7 @@ Advice: ☞ candidate is not viable × expected `String` type, got `Rational` Error: × String - ╭─[ppl.ppl:185:5] + ╭─[lib.ppl:185:5] 184 │ @mangle_as("string_plus_string") 185 │ fn <:String> + <:String> -> String · ▲ @@ -64,7 +64,7 @@ Advice: ☞ candidate is not viable × expected `MemoryAddress` type, got `Rational` Error: × MemoryAddress - ╭─[ppl.ppl:263:5] + ╭─[lib.ppl:263:5] 262 │ /// Get another memory address by adding offset to this one 263 │ fn + -> MemoryAddress: · ───┬─── @@ -79,7 +79,7 @@ Advice: ☞ candidate is not viable × expected `I32` type, got `Rational` Error: × I32 - ╭─[ppl.ppl:387:5] + ╭─[lib.ppl:387:5] 386 │ @mangle_as("i32_plus_i32") 387 │ fn <:I32> + <:I32> -> I32 · ▲ @@ -94,7 +94,7 @@ Advice: ☞ candidate is not viable × expected `F64` type, got `Rational` Error: × F64 - ╭─[ppl.ppl:416:5] + ╭─[lib.ppl:416:5] 415 │ @mangle_as("f64_plus_f64") 416 │ fn <:F64> + <:F64> -> F64 · ▲ diff --git a/src/ir/tests/snapshots/ppl__ir__tests__clone.hir.snap b/src/tests/snapshots/ppl__tests__clone.hir.snap similarity index 88% rename from src/ir/tests/snapshots/ppl__ir__tests__clone.hir.snap rename to src/tests/snapshots/ppl__tests__clone.hir.snap index d35ba218..5cf7f5a7 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__clone.hir.snap +++ b/src/tests/snapshots/ppl__tests__clone.hir.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let mut x: Integer = 1 diff --git a/src/ir/tests/snapshots/ppl__ir__tests__clone.ir.snap b/src/tests/snapshots/ppl__tests__clone.ir.snap similarity index 92% rename from src/ir/tests/snapshots/ppl__ir__tests__clone.ir.snap rename to src/tests/snapshots/ppl__tests__clone.ir.snap index e61bcfb0..49e72ea0 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__clone.ir.snap +++ b/src/tests/snapshots/ppl__tests__clone.ir.snap @@ -1,9 +1,9 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'clone' -source_filename = "clone.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/clone/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -55,7 +55,7 @@ return: ; preds = %0 declare %Integer @clone_integer(%Integer) -define void @clone.execute() !dbg !13 { +define void @main.execute() !dbg !13 { init_globals: call void @initialize(), !dbg !14 call void @initialize.1(), !dbg !15 @@ -108,7 +108,7 @@ declare void @destroy_integer(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "clone.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/clone/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -119,7 +119,7 @@ declare void @destroy_integer(%Integer) !10 = !DILocation(line: 0, column: 12, scope: !9) !11 = distinct !DISubprogram(name: "initialize.2", linkageName: "initialize.2", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 1, column: 12, scope: !11) -!13 = distinct !DISubprogram(name: "clone.execute", linkageName: "clone.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!13 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 7, scope: !13) !15 = !DILocation(line: 0, column: 12, scope: !13) !16 = !DILocation(line: 1, column: 12, scope: !13) diff --git a/src/ir/tests/snapshots/ppl__ir__tests__clone.run.snap b/src/tests/snapshots/ppl__tests__clone.run.snap similarity index 56% rename from src/ir/tests/snapshots/ppl__ir__tests__clone.run.snap rename to src/tests/snapshots/ppl__tests__clone.run.snap index 98dfcb95..0d09e579 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__clone.run.snap +++ b/src/tests/snapshots/ppl__tests__clone.run.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- 1 diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.hir.snap b/src/tests/snapshots/ppl__tests__common_functions.hir.snap similarity index 67% rename from src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.hir.snap rename to src/tests/snapshots/ppl__tests__common_functions.hir.snap index 0da3afc1..316f120e 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.hir.snap +++ b/src/tests/snapshots/ppl__tests__common_functions.hir.snap @@ -1,5 +1,5 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: hir --- fn foo -> None: diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.ir.snap b/src/tests/snapshots/ppl__tests__common_functions.ir.snap similarity index 85% rename from src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.ir.snap rename to src/tests/snapshots/ppl__tests__common_functions.ir.snap index 69b7a0a7..d10a59c7 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.ir.snap +++ b/src/tests/snapshots/ppl__tests__common_functions.ir.snap @@ -1,9 +1,9 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'common_functions' -source_filename = "common_functions.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/common_functions/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -44,7 +44,7 @@ return: ; preds = %0 declare void @"println <:String>"(%String) -define void @common_functions.execute() !dbg !11 { +define void @main.execute() !dbg !11 { init_globals: call void @initialize(), !dbg !12 br label %0, !dbg !12 @@ -62,7 +62,7 @@ return: ; preds = %0 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "common_functions.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/common_functions/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -71,6 +71,6 @@ return: ; preds = %0 !8 = !DILocation(line: 0, scope: !3) !9 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 0, column: 18, scope: !9) -!11 = distinct !DISubprogram(name: "common_functions.execute", linkageName: "common_functions.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!11 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 1, column: 5, scope: !11) !13 = !DILocation(line: 1, scope: !11) diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.run.snap b/src/tests/snapshots/ppl__tests__common_functions.run.snap similarity index 50% rename from src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.run.snap rename to src/tests/snapshots/ppl__tests__common_functions.run.snap index 831b02d5..af58f5d2 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__common_functions.run.snap +++ b/src/tests/snapshots/ppl__tests__common_functions.run.snap @@ -1,5 +1,5 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- foo diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__constraints.error.snap b/src/tests/snapshots/ppl__tests__constraints.error.snap similarity index 88% rename from src/semantics/tests/snapshots/ppl__semantics__tests__constraints.error.snap rename to src/tests/snapshots/ppl__tests__constraints.error.snap index 8d6cf240..c2fef5df 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__constraints.error.snap +++ b/src/tests/snapshots/ppl__tests__constraints.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::no_function × no function `bar <:Integer>` - ╭─[constraints.ppl:10:5] + ╭─[main.ppl:10:5] 9 │ bar none 10 │ bar 1 · ┬ @@ -21,7 +21,7 @@ Advice: ☞ candidate is not viable semantics::no_function × no function `baz <:None> <:Bool>` - ╭─[constraints.ppl:17:5] + ╭─[main.ppl:17:5] 16 │ baz none none 17 │ baz none true · ──┬─ ──┬─ @@ -36,7 +36,7 @@ Advice: ☞ candidate is not viable × expected `T` type, got `Bool` Error: × T - ╭─[constraints.ppl:12:24] + ╭─[main.ppl:12:24] 11 │ 12 │ fn baz : · ┬ @@ -48,7 +48,7 @@ Advice: ☞ candidate is not viable semantics::no_function × no function `baz <:Bool> <:None>` - ╭─[constraints.ppl:18:5] + ╭─[main.ppl:18:5] 17 │ baz none true 18 │ baz true none · ──┬─ ──┬─ @@ -63,7 +63,7 @@ Advice: ☞ candidate is not viable × expected `T` type, got `None` Error: × T - ╭─[constraints.ppl:12:24] + ╭─[main.ppl:12:24] 11 │ 12 │ fn baz : · ┬ diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__constraints_in_constructor.error.snap b/src/tests/snapshots/ppl__tests__constraints_in_constructor.error.snap similarity index 76% rename from src/semantics/tests/snapshots/ppl__semantics__tests__constraints_in_constructor.error.snap rename to src/tests/snapshots/ppl__tests__constraints_in_constructor.error.snap index 4eb0efd0..9d6a23d4 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__constraints_in_constructor.error.snap +++ b/src/tests/snapshots/ppl__tests__constraints_in_constructor.error.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::type_mismatch @@ -7,7 +7,7 @@ Error: semantics::type_mismatch × expected `T` type, got `Rational` Error: × T - ╭─[constraints_in_constructor.ppl:2:5] + ╭─[main.ppl:2:5] 1 │ type Point: 2 │ x, y: T · ┬ @@ -15,7 +15,7 @@ Error: × T 3 │ ╰──── Error: × Rational - ╭─[constraints_in_constructor.ppl:4:18] + ╭─[main.ppl:4:18] 3 │ 4 │ Point { x: 1, y: 0.1 } · ─┬─ diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.hir.snap b/src/tests/snapshots/ppl__tests__consume_greater.hir.snap similarity index 68% rename from src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.hir.snap rename to src/tests/snapshots/ppl__tests__consume_greater.hir.snap index c07e8944..1d58619d 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.hir.snap +++ b/src/tests/snapshots/ppl__tests__consume_greater.hir.snap @@ -1,5 +1,5 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type Point: diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.ir.snap b/src/tests/snapshots/ppl__tests__consume_greater.ir.snap similarity index 85% rename from src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.ir.snap rename to src/tests/snapshots/ppl__tests__consume_greater.ir.snap index a1e3af8b..29d844fb 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__consume_greater.ir.snap +++ b/src/tests/snapshots/ppl__tests__consume_greater.ir.snap @@ -1,9 +1,9 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'consume_greater' -source_filename = "consume_greater.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/consume_greater/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -33,7 +33,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @consume_greater.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -55,14 +55,14 @@ return: ; preds = %0 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "consume_greater.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/consume_greater/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 3, column: 23, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "consume_greater.execute", linkageName: "consume_greater.execute", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 3, column: 23, scope: !9) !11 = !DILocation(line: 3, scope: !9) !12 = !DILocation(line: 3, column: 20, scope: !9) diff --git a/src/tests/snapshots/ppl__tests__consume_greater.run.snap b/src/tests/snapshots/ppl__tests__consume_greater.run.snap new file mode 100644 index 00000000..d3cdb9f0 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__consume_greater.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- + diff --git a/src/tests/snapshots/ppl__tests__deps.hir.snap b/src/tests/snapshots/ppl__tests__deps.hir.snap new file mode 100644 index 00000000..2ec2da14 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__deps.hir.snap @@ -0,0 +1,6 @@ +--- +source: src/tests/mod.rs +expression: hir +--- +use helper.* +say hello diff --git a/src/tests/snapshots/ppl__tests__deps.ir.snap b/src/tests/snapshots/ppl__tests__deps.ir.snap new file mode 100644 index 00000000..8afb9596 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__deps.ir.snap @@ -0,0 +1,64 @@ +--- +source: src/tests/mod.rs +expression: ir +--- +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/deps/src/main.ppl" + +%"Type" = type { %String, %Integer } +%String = type { ptr } +%Integer = type { ptr } + +@"Type" = private global %"Type" zeroinitializer +@0 = private unnamed_addr constant [7 x i8] c"String\00", align 1 + +define private void @initialize() !dbg !3 { + %1 = alloca %"Type", align 8, !dbg !7 + %"Type.name" = getelementptr inbounds %"Type", ptr %1, i32 0, i32 0, !dbg !7 + %2 = call %String @string_from_c_string_and_length(ptr @0, i64 6), !dbg !8 + store %String %2, ptr %"Type.name", align 8, !dbg !8 + %"Type.size" = getelementptr inbounds %"Type", ptr %1, i32 0, i32 1, !dbg !8 + %3 = call %Integer @integer_from_i64(i64 8), !dbg !8 + store %Integer %3, ptr %"Type.size", align 8, !dbg !8 + %4 = load %"Type", ptr %1, align 8, !dbg !8 + store %"Type" %4, ptr @"Type", align 8, !dbg !8 + br label %return, !dbg !8 + +return: ; preds = %0 + ret void +} + +declare %String @string_from_c_string_and_length(ptr, i64) + +declare %Integer @integer_from_i64(i64) + +define void @main.execute() !dbg !9 { +init_globals: + call void @initialize(), !dbg !10 + br label %0, !dbg !10 + +0: ; preds = %init_globals + call void @"say hello"(), !dbg !11 + br label %return, !dbg !10 + +return: ; preds = %0 + ret void +} + +declare void @"say hello"() + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/deps/src/main.ppl", directory: ".") +!3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!4 = !DISubroutineType(types: !5) +!5 = !{!6} +!6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) +!7 = !DILocation(line: 3, scope: !3) +!8 = !DILocation(line: 0, scope: !3) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!10 = !DILocation(line: 3, scope: !9) +!11 = !DILocation(line: 2, scope: !9) diff --git a/src/tests/snapshots/ppl__tests__deps.run.snap b/src/tests/snapshots/ppl__tests__deps.run.snap new file mode 100644 index 00000000..e76a4697 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__deps.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +Hello, World! diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.hir.snap b/src/tests/snapshots/ppl__tests__deref_member_ref.hir.snap similarity index 83% rename from src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.hir.snap rename to src/tests/snapshots/ppl__tests__deref_member_ref.hir.snap index 4d914350..29c2a548 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.hir.snap +++ b/src/tests/snapshots/ppl__tests__deref_member_ref.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type Point: diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.ir.snap b/src/tests/snapshots/ppl__tests__deref_member_ref.ir.snap similarity index 90% rename from src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.ir.snap rename to src/tests/snapshots/ppl__tests__deref_member_ref.ir.snap index 07ce638e..10d3b51b 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__deref_member_ref.ir.snap +++ b/src/tests/snapshots/ppl__tests__deref_member_ref.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'deref_member_ref' -source_filename = "deref_member_ref.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/deref_member_ref/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -48,7 +48,7 @@ return: ; preds = %1 ret %Integer %4 } -define void @deref_member_ref.execute() !dbg !11 { +define void @main.execute() !dbg !11 { init_globals: call void @initialize(), !dbg !12 br label %0, !dbg !12 @@ -90,7 +90,7 @@ declare %String @integer_as_string(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "deref_member_ref.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/deref_member_ref/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -99,7 +99,7 @@ declare %String @integer_as_string(%Integer) !8 = !DILocation(line: 0, scope: !3) !9 = distinct !DISubprogram(name: "x of <:Reference>", linkageName: "x of <:Reference>", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 3, column: 33, scope: !9) -!11 = distinct !DISubprogram(name: "deref_member_ref.execute", linkageName: "deref_member_ref.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!11 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 5, column: 34, scope: !11) !13 = !DILocation(line: 5, column: 14, scope: !11) !14 = !DILocation(line: 5, column: 25, scope: !11) diff --git a/src/tests/snapshots/ppl__tests__deref_member_ref.run.snap b/src/tests/snapshots/ppl__tests__deref_member_ref.run.snap new file mode 100644 index 00000000..6beaae09 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__deref_member_ref.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.hir.snap b/src/tests/snapshots/ppl__tests__destructor.hir.snap similarity index 86% rename from src/semantics/tests/snapshots/ppl__semantics__tests__destructor.hir.snap rename to src/tests/snapshots/ppl__tests__destructor.hir.snap index 3f799191..4fca8341 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.hir.snap +++ b/src/tests/snapshots/ppl__tests__destructor.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type Destructible diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.ir.snap b/src/tests/snapshots/ppl__tests__destructor.ir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__destructor.ir.snap rename to src/tests/snapshots/ppl__tests__destructor.ir.snap index 6681fee9..f1411e68 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.ir.snap +++ b/src/tests/snapshots/ppl__tests__destructor.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'destructor' -source_filename = "destructor.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/destructor/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -55,7 +55,7 @@ return: ; preds = %0 ret void } -define void @destructor.execute() !dbg !13 { +define void @main.execute() !dbg !13 { init_globals: call void @initialize(), !dbg !14 call void @initialize.1(), !dbg !15 @@ -79,7 +79,7 @@ return: ; preds = %0 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "destructor.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/destructor/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -90,7 +90,7 @@ return: ; preds = %0 !10 = !DILocation(line: 2, column: 38, scope: !9) !11 = distinct !DISubprogram(name: "initialize.1", linkageName: "initialize.1", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 4, column: 12, scope: !11) -!13 = distinct !DISubprogram(name: "destructor.execute", linkageName: "destructor.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!13 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 7, column: 14, scope: !13) !15 = !DILocation(line: 4, column: 12, scope: !13) !16 = !DILocation(line: 5, scope: !13) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.run.snap b/src/tests/snapshots/ppl__tests__destructor.run.snap similarity index 55% rename from src/semantics/tests/snapshots/ppl__semantics__tests__destructor.run.snap rename to src/tests/snapshots/ppl__tests__destructor.run.snap index 25d7e0bc..f502914e 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__destructor.run.snap +++ b/src/tests/snapshots/ppl__tests__destructor.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- destructor diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__empty_block.error.snap b/src/tests/snapshots/ppl__tests__empty_block.error.snap similarity index 63% rename from src/syntax/tests/snapshots/ppl__syntax__tests__empty_block.error.snap rename to src/tests/snapshots/ppl__tests__empty_block.error.snap index 96109024..e5c15a51 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__empty_block.error.snap +++ b/src/tests/snapshots/ppl__tests__empty_block.error.snap @@ -1,11 +1,11 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: parser::empty_block × empty blocks are disallowed - ╭─[empty_block.ppl:1:1] + ╭─[/Users/gavrilikhin_d/Code/ppl/src/tests/empty_block/src/main.ppl:1:1] 1 │ loop: · ──┬─ · ╰── this item has empty block diff --git a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.hir.snap b/src/tests/snapshots/ppl__tests__empty_constructor.hir.snap similarity index 71% rename from src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.hir.snap rename to src/tests/snapshots/ppl__tests__empty_constructor.hir.snap index 5c1c8e76..593b98de 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.hir.snap +++ b/src/tests/snapshots/ppl__tests__empty_constructor.hir.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type A diff --git a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.ir.snap b/src/tests/snapshots/ppl__tests__empty_constructor.ir.snap similarity index 93% rename from src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.ir.snap rename to src/tests/snapshots/ppl__tests__empty_constructor.ir.snap index a6f61333..283a94fb 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.ir.snap +++ b/src/tests/snapshots/ppl__tests__empty_constructor.ir.snap @@ -1,9 +1,9 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'empty_constructor' -source_filename = "empty_constructor.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/empty_constructor/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -61,7 +61,7 @@ return: ; preds = %0 ret void } -define void @empty_constructor.execute() !dbg !14 { +define void @main.execute() !dbg !14 { init_globals: call void @initialize(), !dbg !15 call void @initialize.1(), !dbg !15 @@ -122,7 +122,7 @@ return: ; preds = %1 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "empty_constructor.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/empty_constructor/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -134,7 +134,7 @@ return: ; preds = %1 !11 = !DILocation(line: 0, scope: !9) !12 = distinct !DISubprogram(name: "initialize.2", linkageName: "initialize.2", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !13 = !DILocation(line: 1, column: 8, scope: !12) -!14 = distinct !DISubprogram(name: "empty_constructor.execute", linkageName: "empty_constructor.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!14 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !15 = !DILocation(line: 2, column: 21, scope: !14) !16 = !DILocation(line: 1, column: 8, scope: !14) !17 = !DILocation(line: 2, column: 19, scope: !14) diff --git a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.run.snap b/src/tests/snapshots/ppl__tests__empty_constructor.run.snap similarity index 51% rename from src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.run.snap rename to src/tests/snapshots/ppl__tests__empty_constructor.run.snap index 0206ef51..e5b7afd8 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__empty_constructor.run.snap +++ b/src/tests/snapshots/ppl__tests__empty_constructor.run.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- A diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.hir.snap b/src/tests/snapshots/ppl__tests__escaped_id.hir.snap similarity index 72% rename from src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.hir.snap rename to src/tests/snapshots/ppl__tests__escaped_id.hir.snap index d4171e16..0bc39d8d 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.hir.snap +++ b/src/tests/snapshots/ppl__tests__escaped_id.hir.snap @@ -1,5 +1,5 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let mut if: Integer = 1 diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.ir.snap b/src/tests/snapshots/ppl__tests__escaped_id.ir.snap similarity index 87% rename from src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.ir.snap rename to src/tests/snapshots/ppl__tests__escaped_id.ir.snap index fb4cdb2a..af5477ec 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__escaped_id.ir.snap +++ b/src/tests/snapshots/ppl__tests__escaped_id.ir.snap @@ -1,9 +1,9 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'escaped_id' -source_filename = "escaped_id.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/escaped_id/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -42,7 +42,7 @@ return: ; preds = %0 ret void } -define void @escaped_id.execute() !dbg !11 { +define void @main.execute() !dbg !11 { init_globals: call void @initialize(), !dbg !12 call void @initialize.1(), !dbg !13 @@ -66,7 +66,7 @@ declare void @destroy_integer(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "escaped_id.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/escaped_id/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -75,7 +75,7 @@ declare void @destroy_integer(%Integer) !8 = !DILocation(line: 0, scope: !3) !9 = distinct !DISubprogram(name: "initialize.1", linkageName: "initialize.1", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 0, column: 15, scope: !9) -!11 = distinct !DISubprogram(name: "escaped_id.execute", linkageName: "escaped_id.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!11 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 1, column: 8, scope: !11) !13 = !DILocation(line: 0, column: 15, scope: !11) !14 = !DILocation(line: 1, scope: !11) diff --git a/src/tests/snapshots/ppl__tests__escaped_id.run.snap b/src/tests/snapshots/ppl__tests__escaped_id.run.snap new file mode 100644 index 00000000..d3cdb9f0 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__escaped_id.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- + diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.hir.snap b/src/tests/snapshots/ppl__tests__generics.hir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__generics.hir.snap rename to src/tests/snapshots/ppl__tests__generics.hir.snap index ef2e93dd..b47c7b14 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.hir.snap +++ b/src/tests/snapshots/ppl__tests__generics.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type Point: diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.ir.snap b/src/tests/snapshots/ppl__tests__generics.ir.snap similarity index 95% rename from src/semantics/tests/snapshots/ppl__semantics__tests__generics.ir.snap rename to src/tests/snapshots/ppl__tests__generics.ir.snap index 4d750668..a36036e0 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.ir.snap +++ b/src/tests/snapshots/ppl__tests__generics.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'generics' -source_filename = "generics.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/generics/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -66,7 +66,7 @@ return: ; preds = %1 ret %Integer %3 } -define void @generics.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 call void @initialize.1(), !dbg !17 @@ -165,7 +165,7 @@ return: ; preds = %1 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "generics.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/generics/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 13, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -178,7 +178,7 @@ return: ; preds = %1 !12 = !DILocation(line: 5, column: 30, scope: !9) !13 = distinct !DISubprogram(name: "x of <:Point>", linkageName: "x of <:Point>", scope: !9, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 3, column: 28, scope: !13) -!15 = distinct !DISubprogram(name: "generics.execute", linkageName: "generics.execute", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 13, scope: !15) !17 = !DILocation(line: 5, column: 8, scope: !15) !18 = !DILocation(line: 6, column: 8, scope: !15) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.run.snap b/src/tests/snapshots/ppl__tests__generics.run.snap similarity index 55% rename from src/semantics/tests/snapshots/ppl__semantics__tests__generics.run.snap rename to src/tests/snapshots/ppl__tests__generics.run.snap index 91135f34..eb8b1cc3 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__generics.run.snap +++ b/src/tests/snapshots/ppl__tests__generics.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- true diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.hir.snap b/src/tests/snapshots/ppl__tests__import_all.hir.snap similarity index 58% rename from src/semantics/tests/snapshots/ppl__semantics__tests__import_all.hir.snap rename to src/tests/snapshots/ppl__tests__import_all.hir.snap index cccde3b3..1c34c821 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.hir.snap +++ b/src/tests/snapshots/ppl__tests__import_all.hir.snap @@ -1,7 +1,7 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- -use lib.* +use utils.* println do nothing println do something diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.ir.snap b/src/tests/snapshots/ppl__tests__import_all.ir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__import_all.ir.snap rename to src/tests/snapshots/ppl__tests__import_all.ir.snap index 64784a1b..4515703a 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.ir.snap +++ b/src/tests/snapshots/ppl__tests__import_all.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'import_all' -source_filename = "import_all.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/import_all/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -32,7 +32,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @import_all.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -84,14 +84,14 @@ declare %Integer @"do something"() !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "import_all.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/import_all/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 3, column: 22, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "import_all.execute", linkageName: "import_all.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 3, column: 22, scope: !9) !11 = !DILocation(line: 2, column: 9, scope: !9) !12 = !DILocation(line: 3, column: 9, scope: !9) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.run.snap b/src/tests/snapshots/ppl__tests__import_all.run.snap similarity index 50% rename from src/semantics/tests/snapshots/ppl__semantics__tests__import_all.run.snap rename to src/tests/snapshots/ppl__tests__import_all.run.snap index fcc49c0d..75de562a 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__import_all.run.snap +++ b/src/tests/snapshots/ppl__tests__import_all.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- none diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.hir.snap b/src/tests/snapshots/ppl__tests__integer.hir.snap similarity index 78% rename from src/semantics/tests/snapshots/ppl__semantics__tests__integer.hir.snap rename to src/tests/snapshots/ppl__tests__integer.hir.snap index 5faf6fcc..930ae9b5 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.hir.snap +++ b/src/tests/snapshots/ppl__tests__integer.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- println 0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.ir.snap b/src/tests/snapshots/ppl__tests__integer.ir.snap similarity index 93% rename from src/semantics/tests/snapshots/ppl__semantics__tests__integer.ir.snap rename to src/tests/snapshots/ppl__tests__integer.ir.snap index e107d29a..da27a846 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.ir.snap +++ b/src/tests/snapshots/ppl__tests__integer.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'integer' -source_filename = "integer.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/integer/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -33,7 +33,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @integer.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -122,14 +122,14 @@ declare %Rational @integer_slash_integer(%Integer, %Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "integer.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/integer/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 7, column: 14, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "integer.execute", linkageName: "integer.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 7, column: 14, scope: !9) !11 = !DILocation(line: 0, column: 8, scope: !9) !12 = !DILocation(line: 1, column: 9, scope: !9) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.run.snap b/src/tests/snapshots/ppl__tests__integer.run.snap similarity index 57% rename from src/semantics/tests/snapshots/ppl__semantics__tests__integer.run.snap rename to src/tests/snapshots/ppl__tests__integer.run.snap index ea21e983..20c0b4a8 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__integer.run.snap +++ b/src/tests/snapshots/ppl__tests__integer.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- 0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__integer_not_eq_rational.error.snap b/src/tests/snapshots/ppl__tests__integer_not_eq_rational.error.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__integer_not_eq_rational.error.snap rename to src/tests/snapshots/ppl__tests__integer_not_eq_rational.error.snap index cd1c5d3f..bd98fdba 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__integer_not_eq_rational.error.snap +++ b/src/tests/snapshots/ppl__tests__integer_not_eq_rational.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::no_function × no operator `<:Integer> != <:Rational>` - ╭─[integer_not_eq_rational.ppl:1:1] + ╭─[main.ppl:1:1] 1 │ 1 != 1.0 · ┬ ─┬ ─┬─ · │ │ ╰── <:Rational> diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__invalid_indentation.error.snap b/src/tests/snapshots/ppl__tests__invalid_indentation.error.snap similarity index 69% rename from src/syntax/tests/snapshots/ppl__syntax__tests__invalid_indentation.error.snap rename to src/tests/snapshots/ppl__tests__invalid_indentation.error.snap index 46c51140..467d1f13 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__invalid_indentation.error.snap +++ b/src/tests/snapshots/ppl__tests__invalid_indentation.error.snap @@ -1,11 +1,11 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: lexer::invalid_indentation × using spaces instead of tabs for indentation - ╭─[invalid_indentation.ppl:2:1] + ╭─[/Users/gavrilikhin_d/Code/ppl/src/tests/invalid_indentation/src/main.ppl:2:1] 1 │ loop: 2 │ println "Spaces suck" · ──┬─ diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.hir.snap b/src/tests/snapshots/ppl__tests__memory.hir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__memory.hir.snap rename to src/tests/snapshots/ppl__tests__memory.hir.snap index a7ff5e70..354b0017 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.hir.snap +++ b/src/tests/snapshots/ppl__tests__memory.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let address: MemoryAddress = allocate 1 (Type:Type) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.ir.snap b/src/tests/snapshots/ppl__tests__memory.ir.snap similarity index 95% rename from src/semantics/tests/snapshots/ppl__semantics__tests__memory.ir.snap rename to src/tests/snapshots/ppl__tests__memory.ir.snap index a63f5234..d0a17c0b 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__memory.ir.snap +++ b/src/tests/snapshots/ppl__tests__memory.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'memory' -source_filename = "memory.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/memory/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -116,7 +116,7 @@ return: ; preds = %0 declare ptr @read_memory(%"Type", %MemoryAddress) -define void @memory.execute() !dbg !22 { +define void @main.execute() !dbg !22 { init_globals: call void @initialize(), !dbg !23 call void @initialize.1(), !dbg !24 @@ -164,7 +164,7 @@ declare %String @integer_as_string(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "memory.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/memory/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -184,7 +184,7 @@ declare %String @integer_as_string(%Integer) !19 = distinct !DISubprogram(name: "initialize.3", linkageName: "initialize.3", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !20 = !DILocation(line: 1, column: 8, scope: !19) !21 = !DILocation(line: 1, column: 19, scope: !19) -!22 = distinct !DISubprogram(name: "memory.execute", linkageName: "memory.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!22 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !23 = !DILocation(line: 5, column: 9, scope: !22) !24 = !DILocation(line: 0, column: 25, scope: !22) !25 = !DILocation(line: 0, column: 14, scope: !22) diff --git a/src/tests/snapshots/ppl__tests__memory.run.snap b/src/tests/snapshots/ppl__tests__memory.run.snap new file mode 100644 index 00000000..72969f69 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__memory.run.snap @@ -0,0 +1,6 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +0 +1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__missing_fields.error.snap b/src/tests/snapshots/ppl__tests__missing_fields.error.snap similarity index 75% rename from src/semantics/tests/snapshots/ppl__semantics__tests__missing_fields.error.snap rename to src/tests/snapshots/ppl__tests__missing_fields.error.snap index a1975515..427aea0d 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__missing_fields.error.snap +++ b/src/tests/snapshots/ppl__tests__missing_fields.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::missing_fields × type `Point` has missing fields: [`x`] - ╭─[missing_fields.ppl:4:1] + ╭─[main.ppl:4:1] 3 │ 4 │ Point { y: 1 } · ──┬── diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.hir.snap b/src/tests/snapshots/ppl__tests__monomorphize.hir.snap similarity index 83% rename from src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.hir.snap rename to src/tests/snapshots/ppl__tests__monomorphize.hir.snap index 3b4610a2..7403080c 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.hir.snap +++ b/src/tests/snapshots/ppl__tests__monomorphize.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- type Point: diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.ir.snap b/src/tests/snapshots/ppl__tests__monomorphize.ir.snap similarity index 92% rename from src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.ir.snap rename to src/tests/snapshots/ppl__tests__monomorphize.ir.snap index 4be8f685..f22f49e5 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__monomorphize.ir.snap +++ b/src/tests/snapshots/ppl__tests__monomorphize.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'monomorphize' -source_filename = "monomorphize.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/monomorphize/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -63,7 +63,7 @@ return: ; preds = %0 declare %Integer @clone_integer(%Integer) -define void @monomorphize.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 call void @initialize.1(), !dbg !17 @@ -105,7 +105,7 @@ declare i1 @integer_eq_integer(%Integer, %Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "monomorphize.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/monomorphize/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -118,7 +118,7 @@ declare i1 @integer_eq_integer(%Integer, %Integer) !12 = !DILocation(line: 3, column: 25, scope: !9) !13 = distinct !DISubprogram(name: "initialize.2", linkageName: "initialize.2", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 4, column: 8, scope: !13) -!15 = distinct !DISubprogram(name: "monomorphize.execute", linkageName: "monomorphize.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 5, column: 14, scope: !15) !17 = !DILocation(line: 3, column: 8, scope: !15) !18 = !DILocation(line: 4, column: 8, scope: !15) diff --git a/src/tests/snapshots/ppl__tests__monomorphize.run.snap b/src/tests/snapshots/ppl__tests__monomorphize.run.snap new file mode 100644 index 00000000..dd481580 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__monomorphize.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +true diff --git a/src/driver/tests/snapshots/ppl__driver__tests__multifile.hir.snap b/src/tests/snapshots/ppl__tests__multifile.hir.snap similarity index 66% rename from src/driver/tests/snapshots/ppl__driver__tests__multifile.hir.snap rename to src/tests/snapshots/ppl__tests__multifile.hir.snap index 1a4a8fda..d2bbf02e 100644 --- a/src/driver/tests/snapshots/ppl__driver__tests__multifile.hir.snap +++ b/src/tests/snapshots/ppl__tests__multifile.hir.snap @@ -1,5 +1,5 @@ --- -source: src/driver/tests/mod.rs +source: src/tests/mod.rs expression: hir --- use greet.greet <:String> diff --git a/src/driver/tests/snapshots/ppl__driver__tests__multifile.ir.snap b/src/tests/snapshots/ppl__tests__multifile.ir.snap similarity index 84% rename from src/driver/tests/snapshots/ppl__driver__tests__multifile.ir.snap rename to src/tests/snapshots/ppl__tests__multifile.ir.snap index 275907f2..b53ce9d7 100644 --- a/src/driver/tests/snapshots/ppl__driver__tests__multifile.ir.snap +++ b/src/tests/snapshots/ppl__tests__multifile.ir.snap @@ -1,9 +1,9 @@ --- -source: src/driver/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'multifile' -source_filename = "multifile.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/multifile/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -33,7 +33,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @multifile.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -54,13 +54,13 @@ declare void @"greet <:String>"(%String) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "multifile.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/multifile/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 2, column: 13, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "multifile.execute", linkageName: "multifile.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 2, column: 13, scope: !9) !11 = !DILocation(line: 2, column: 6, scope: !9) diff --git a/src/driver/tests/snapshots/ppl__driver__tests__multifile.run.snap b/src/tests/snapshots/ppl__tests__multifile.run.snap similarity index 55% rename from src/driver/tests/snapshots/ppl__driver__tests__multifile.run.snap rename to src/tests/snapshots/ppl__tests__multifile.run.snap index 904d840b..c64106d7 100644 --- a/src/driver/tests/snapshots/ppl__driver__tests__multifile.run.snap +++ b/src/tests/snapshots/ppl__tests__multifile.run.snap @@ -1,5 +1,5 @@ --- -source: src/driver/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- Hello World diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__multiple_errors.error.snap b/src/tests/snapshots/ppl__tests__multiple_errors.error.snap similarity index 81% rename from src/semantics/tests/snapshots/ppl__semantics__tests__multiple_errors.error.snap rename to src/tests/snapshots/ppl__tests__multiple_errors.error.snap index 6a5b39bd..0e2f195f 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__multiple_errors.error.snap +++ b/src/tests/snapshots/ppl__tests__multiple_errors.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::undefined_variable × variable `y` is not defined - ╭─[multiple_errors.ppl:1:1] + ╭─[main.ppl:1:1] 1 │ y = 2 · ┬ · ╰── reference to undefined variable @@ -14,7 +14,7 @@ Error: semantics::undefined_variable semantics::no_member × no member `x` in `Integer` - ╭─[multiple_errors.ppl:2:1] + ╭─[main.ppl:2:1] 1 │ y = 2 2 │ Integer { x: 1 } · ───┬─── ┬ diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__multiple_initialization.error.snap b/src/tests/snapshots/ppl__tests__multiple_initialization.error.snap similarity index 80% rename from src/semantics/tests/snapshots/ppl__semantics__tests__multiple_initialization.error.snap rename to src/tests/snapshots/ppl__tests__multiple_initialization.error.snap index eb1341a0..2887ce22 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__multiple_initialization.error.snap +++ b/src/tests/snapshots/ppl__tests__multiple_initialization.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::multiple_initialization × field `x` initialized multiple times - ╭─[multiple_initialization.ppl:4:9] + ╭─[main.ppl:4:9] 3 │ 4 │ Point { x: 1, x: 2 } · ──┬─ ──┬─ diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__non_class_constructor.error.snap b/src/tests/snapshots/ppl__tests__non_class_constructor.error.snap similarity index 76% rename from src/semantics/tests/snapshots/ppl__semantics__tests__non_class_constructor.error.snap rename to src/tests/snapshots/ppl__tests__non_class_constructor.error.snap index 49adc73d..a3193836 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__non_class_constructor.error.snap +++ b/src/tests/snapshots/ppl__tests__non_class_constructor.error.snap @@ -1,11 +1,11 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::non_class_constructor × constructor can be used only with class types - ╭─[non_class_constructor.ppl:4:1] + ╭─[main.ppl:4:1] 3 │ 4 │ Trait { x: 1 } · ──┬── diff --git a/src/tests/snapshots/ppl__tests__non_class_constructor.hir.snap b/src/tests/snapshots/ppl__tests__non_class_constructor.hir.snap new file mode 100644 index 00000000..7354ffc3 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__non_class_constructor.hir.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: hir +--- + diff --git a/src/tests/snapshots/ppl__tests__non_class_constructor.ir.snap b/src/tests/snapshots/ppl__tests__non_class_constructor.ir.snap new file mode 100644 index 00000000..7cb42007 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__non_class_constructor.ir.snap @@ -0,0 +1,59 @@ +--- +source: src/tests/mod.rs +expression: ir +--- +; ModuleID = 'main' +source_filename = "src/main.ppl" + +%"Type" = type { %String, %Integer } +%String = type { ptr } +%Integer = type { ptr } + +@"Type" = private global %"Type" zeroinitializer +@0 = private unnamed_addr constant [7 x i8] c"String\00", align 1 + +define private void @initialize() !dbg !3 { + %1 = alloca %"Type", align 8, !dbg !7 + %"Type.name" = getelementptr inbounds %"Type", ptr %1, i32 0, i32 0, !dbg !7 + %2 = call %String @string_from_c_string_and_length(ptr @0, i64 6), !dbg !7 + store %String %2, ptr %"Type.name", align 8, !dbg !7 + %"Type.size" = getelementptr inbounds %"Type", ptr %1, i32 0, i32 1, !dbg !7 + %3 = call %Integer @integer_from_i64(i64 8), !dbg !7 + store %Integer %3, ptr %"Type.size", align 8, !dbg !7 + %4 = load %"Type", ptr %1, align 8, !dbg !7 + store %"Type" %4, ptr @"Type", align 8, !dbg !7 + br label %return, !dbg !7 + +return: ; preds = %0 + ret void +} + +declare %String @string_from_c_string_and_length(ptr, i64) + +declare %Integer @integer_from_i64(i64) + +define void @main.execute() !dbg !8 { +init_globals: + call void @initialize(), !dbg !9 + br label %0, !dbg !9 + +0: ; preds = %init_globals + br label %return, !dbg !9 + +return: ; preds = %0 + ret void +} + +!llvm.module.flags = !{!0} +!llvm.dbg.cu = !{!1} + +!0 = !{i32 2, !"Debug Info Version", i32 3} +!1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") +!2 = !DIFile(filename: "src/main.ppl", directory: ".") +!3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!4 = !DISubroutineType(types: !5) +!5 = !{!6} +!6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) +!7 = !DILocation(line: 0, scope: !3) +!8 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = !DILocation(line: 0, scope: !8) diff --git a/src/tests/snapshots/ppl__tests__non_class_constructor.run.snap b/src/tests/snapshots/ppl__tests__non_class_constructor.run.snap new file mode 100644 index 00000000..d3cdb9f0 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__non_class_constructor.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- + diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.hir.snap b/src/tests/snapshots/ppl__tests__plus_assign.hir.snap similarity index 87% rename from src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.hir.snap rename to src/tests/snapshots/ppl__tests__plus_assign.hir.snap index 41650980..a25ddd51 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.hir.snap +++ b/src/tests/snapshots/ppl__tests__plus_assign.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let mut value: Rational = 0.0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.ir.snap b/src/tests/snapshots/ppl__tests__plus_assign.ir.snap similarity index 94% rename from src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.ir.snap rename to src/tests/snapshots/ppl__tests__plus_assign.ir.snap index 084dbd06..edbcfad0 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.ir.snap +++ b/src/tests/snapshots/ppl__tests__plus_assign.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'plus_assign' -source_filename = "plus_assign.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/plus_assign/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -59,7 +59,7 @@ return: ; preds = %0 ret void } -define void @plus_assign.execute() !dbg !13 { +define void @main.execute() !dbg !13 { init_globals: call void @initialize(), !dbg !14 call void @initialize.1(), !dbg !15 @@ -149,7 +149,7 @@ declare %String @clone_string(%String) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "plus_assign.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/plus_assign/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -160,7 +160,7 @@ declare %String @clone_string(%String) !10 = !DILocation(line: 0, column: 16, scope: !9) !11 = distinct !DISubprogram(name: "initialize.2", linkageName: "initialize.2", scope: !2, file: !2, line: 5, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 5, column: 14, scope: !11) -!13 = distinct !DISubprogram(name: "plus_assign.execute", linkageName: "plus_assign.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!13 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 7, column: 11, scope: !13) !15 = !DILocation(line: 0, column: 16, scope: !13) !16 = !DILocation(line: 5, column: 14, scope: !13) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.run.snap b/src/tests/snapshots/ppl__tests__plus_assign.run.snap similarity index 58% rename from src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.run.snap rename to src/tests/snapshots/ppl__tests__plus_assign.run.snap index 03fe045d..b3ce3f29 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__plus_assign.run.snap +++ b/src/tests/snapshots/ppl__tests__plus_assign.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- 0.0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.hir.snap b/src/tests/snapshots/ppl__tests__predeclare_function.hir.snap similarity index 85% rename from src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.hir.snap rename to src/tests/snapshots/ppl__tests__predeclare_function.hir.snap index c20ed7d9..40e1e842 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.hir.snap +++ b/src/tests/snapshots/ppl__tests__predeclare_function.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- fn plus two -> Integer: diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.ir.snap b/src/tests/snapshots/ppl__tests__predeclare_function.ir.snap similarity index 91% rename from src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.ir.snap rename to src/tests/snapshots/ppl__tests__predeclare_function.ir.snap index d94eb16d..283b7a4b 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_function.ir.snap +++ b/src/tests/snapshots/ppl__tests__predeclare_function.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'predeclare_function' -source_filename = "predeclare_function.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/predeclare_function/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -73,7 +73,7 @@ declare %Integer @"sum <:Integer> <:Integer>.1"(%Integer, %Integer) declare %Integer @integer_plus_integer(%Integer, %Integer) -define void @predeclare_function.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 br label %0, !dbg !16 @@ -109,7 +109,7 @@ declare %String @integer_as_string(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "predeclare_function.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/predeclare_function/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -122,7 +122,7 @@ declare %String @integer_as_string(%Integer) !12 = distinct !DISubprogram(name: "sum <:Integer> <:Integer>", linkageName: "sum <:Integer> <:Integer>", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !13 = !DILocation(line: 2, column: 47, scope: !12) !14 = !DILocation(line: 2, column: 51, scope: !12) -!15 = distinct !DISubprogram(name: "predeclare_function.execute", linkageName: "predeclare_function.execute", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 4, column: 20, scope: !15) !17 = !DILocation(line: 4, column: 9, scope: !15) !18 = distinct !DISubprogram(name: "println <:Integer>", linkageName: "println <:Integer>", scope: !15, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) diff --git a/src/tests/snapshots/ppl__tests__predeclare_function.run.snap b/src/tests/snapshots/ppl__tests__predeclare_function.run.snap new file mode 100644 index 00000000..6c6ae65f --- /dev/null +++ b/src/tests/snapshots/ppl__tests__predeclare_function.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +4 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.hir.snap b/src/tests/snapshots/ppl__tests__predeclare_vars.hir.snap similarity index 83% rename from src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.hir.snap rename to src/tests/snapshots/ppl__tests__predeclare_vars.hir.snap index df45e4fe..6cbd7acf 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.hir.snap +++ b/src/tests/snapshots/ppl__tests__predeclare_vars.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let x: Integer = 1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.ir.snap b/src/tests/snapshots/ppl__tests__predeclare_vars.ir.snap similarity index 92% rename from src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.ir.snap rename to src/tests/snapshots/ppl__tests__predeclare_vars.ir.snap index e59818f8..8292b519 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__predeclare_vars.ir.snap +++ b/src/tests/snapshots/ppl__tests__predeclare_vars.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'predeclare_vars' -source_filename = "predeclare_vars.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/predeclare_vars/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -74,7 +74,7 @@ return: ; preds = %0 ret %Integer %2 } -define void @predeclare_vars.execute() !dbg !17 { +define void @main.execute() !dbg !17 { init_globals: call void @initialize(), !dbg !18 call void @initialize.1(), !dbg !19 @@ -114,7 +114,7 @@ declare %Integer @clone_integer(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "predeclare_vars.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/predeclare_vars/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -129,7 +129,7 @@ declare %Integer @clone_integer(%Integer) !14 = !DILocation(line: 3, column: 8, scope: !13) !15 = distinct !DISubprogram(name: "get y", linkageName: "get y", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 4, column: 12, scope: !15) -!17 = distinct !DISubprogram(name: "predeclare_vars.execute", linkageName: "predeclare_vars.execute", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!17 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !18 = !DILocation(line: 6, column: 9, scope: !17) !19 = !DILocation(line: 0, column: 8, scope: !17) !20 = !DILocation(line: 3, column: 8, scope: !17) diff --git a/src/tests/snapshots/ppl__tests__predeclare_vars.run.snap b/src/tests/snapshots/ppl__tests__predeclare_vars.run.snap new file mode 100644 index 00000000..6beaae09 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__predeclare_vars.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.hir.snap b/src/tests/snapshots/ppl__tests__rational.hir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__rational.hir.snap rename to src/tests/snapshots/ppl__tests__rational.hir.snap index ebbff2eb..4511ef71 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.hir.snap +++ b/src/tests/snapshots/ppl__tests__rational.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- println 0.0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.ir.snap b/src/tests/snapshots/ppl__tests__rational.ir.snap similarity index 97% rename from src/semantics/tests/snapshots/ppl__semantics__tests__rational.ir.snap rename to src/tests/snapshots/ppl__tests__rational.ir.snap index 831c701d..791cf8b4 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.ir.snap +++ b/src/tests/snapshots/ppl__tests__rational.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'rational' -source_filename = "rational.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/rational/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -59,7 +59,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @rational.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -257,14 +257,14 @@ return: ; preds = %2 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "rational.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/rational/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 14, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 14, column: 18, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "rational.execute", linkageName: "rational.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 14, column: 18, scope: !9) !11 = !DILocation(line: 0, column: 8, scope: !9) !12 = !DILocation(line: 1, column: 9, scope: !9) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.run.snap b/src/tests/snapshots/ppl__tests__rational.run.snap similarity index 73% rename from src/semantics/tests/snapshots/ppl__semantics__tests__rational.run.snap rename to src/tests/snapshots/ppl__tests__rational.run.snap index a69c0bc6..c8d777fa 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__rational.run.snap +++ b/src/tests/snapshots/ppl__tests__rational.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- 0.0 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.hir.snap b/src/tests/snapshots/ppl__tests__reference_mut.hir.snap similarity index 86% rename from src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.hir.snap rename to src/tests/snapshots/ppl__tests__reference_mut.hir.snap index 3618fa5a..a3926b9b 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.hir.snap +++ b/src/tests/snapshots/ppl__tests__reference_mut.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let mut x: Integer = 1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.ir.snap b/src/tests/snapshots/ppl__tests__reference_mut.ir.snap similarity index 92% rename from src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.ir.snap rename to src/tests/snapshots/ppl__tests__reference_mut.ir.snap index 03294aae..42cd3d0d 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__reference_mut.ir.snap +++ b/src/tests/snapshots/ppl__tests__reference_mut.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'reference_mut' -source_filename = "reference_mut.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/reference_mut/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -65,7 +65,7 @@ return: ; preds = %1 ret ptr %3 } -define void @reference_mut.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 call void @initialize.1(), !dbg !17 @@ -114,7 +114,7 @@ declare %Integer @clone_integer(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "reference_mut.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/reference_mut/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -127,7 +127,7 @@ declare %Integer @clone_integer(%Integer) !12 = !DILocation(line: 1, column: 29, scope: !11) !13 = distinct !DISubprogram(name: "reference to mutable <:ReferenceMut>", linkageName: "reference to mutable <:ReferenceMut>", scope: !11, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 6, scope: !13) -!15 = distinct !DISubprogram(name: "reference_mut.execute", linkageName: "reference_mut.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 6, scope: !15) !17 = !DILocation(line: 0, column: 12, scope: !15) !18 = !DILocation(line: 1, column: 8, scope: !15) diff --git a/src/tests/snapshots/ppl__tests__reference_mut.run.snap b/src/tests/snapshots/ppl__tests__reference_mut.run.snap new file mode 100644 index 00000000..ede29a05 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__reference_mut.run.snap @@ -0,0 +1,7 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +1 +2 +2 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__references.hir.snap b/src/tests/snapshots/ppl__tests__references.hir.snap similarity index 91% rename from src/semantics/tests/snapshots/ppl__semantics__tests__references.hir.snap rename to src/tests/snapshots/ppl__tests__references.hir.snap index a9456fcf..b8336b19 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__references.hir.snap +++ b/src/tests/snapshots/ppl__tests__references.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let n: Integer = size of (Type:Type) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__references.ir.snap b/src/tests/snapshots/ppl__tests__references.ir.snap similarity index 95% rename from src/semantics/tests/snapshots/ppl__semantics__tests__references.ir.snap rename to src/tests/snapshots/ppl__tests__references.ir.snap index fac51fe0..2cf6a0a8 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__references.ir.snap +++ b/src/tests/snapshots/ppl__tests__references.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'references' -source_filename = "references.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/references/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -107,7 +107,7 @@ return: ; preds = %0 declare ptr @read_memory(%"Type", %MemoryAddress) -define void @references.execute() !dbg !21 { +define void @main.execute() !dbg !21 { init_globals: call void @initialize(), !dbg !22 call void @initialize.1(), !dbg !23 @@ -164,7 +164,7 @@ declare void @free_memory(%MemoryAddress) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "references.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/references/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 8, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -183,7 +183,7 @@ declare void @free_memory(%MemoryAddress) !18 = distinct !DISubprogram(name: "initialize.4", linkageName: "initialize.4", scope: !2, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !19 = !DILocation(line: 3, column: 12, scope: !18) !20 = !DILocation(line: 3, column: 19, scope: !18) -!21 = distinct !DISubprogram(name: "references.execute", linkageName: "references.execute", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!21 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 4, type: !4, spFlags: DISPFlagDefinition, unit: !1) !22 = !DILocation(line: 8, column: 12, scope: !21) !23 = !DILocation(line: 0, column: 16, scope: !21) !24 = !DILocation(line: 0, column: 8, scope: !21) diff --git a/src/tests/snapshots/ppl__tests__references.run.snap b/src/tests/snapshots/ppl__tests__references.run.snap new file mode 100644 index 00000000..72969f69 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__references.run.snap @@ -0,0 +1,6 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +0 +1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__specify_variable_ty.error.snap b/src/tests/snapshots/ppl__tests__specify_variable_ty.error.snap similarity index 79% rename from src/semantics/tests/snapshots/ppl__semantics__tests__specify_variable_ty.error.snap rename to src/tests/snapshots/ppl__tests__specify_variable_ty.error.snap index e3c298f3..ad6915a9 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__specify_variable_ty.error.snap +++ b/src/tests/snapshots/ppl__tests__specify_variable_ty.error.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::type_mismatch @@ -7,14 +7,14 @@ Error: semantics::type_mismatch × expected `String` type, got `Integer` Error: × String - ╭─[specify_variable_ty.ppl:4:5] + ╭─[main.ppl:4:5] 3 │ let z: Integer = y 4 │ let error: String = 3 · ──┬── · ╰── this has `String` type ╰──── Error: × Integer - ╭─[specify_variable_ty.ppl:4:21] + ╭─[main.ppl:4:21] 3 │ let z: Integer = y 4 │ let error: String = 3 · ┬ diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__star.hir.snap b/src/tests/snapshots/ppl__tests__star.hir.snap similarity index 56% rename from src/syntax/tests/snapshots/ppl__syntax__tests__star.hir.snap rename to src/tests/snapshots/ppl__tests__star.hir.snap index c526ccd3..fe99e12a 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__star.hir.snap +++ b/src/tests/snapshots/ppl__tests__star.hir.snap @@ -1,5 +1,5 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: hir --- println 2 + 2 * 2 diff --git a/src/syntax/tests/snapshots/ppl__syntax__tests__star.ir.snap b/src/tests/snapshots/ppl__tests__star.ir.snap similarity index 89% rename from src/syntax/tests/snapshots/ppl__syntax__tests__star.ir.snap rename to src/tests/snapshots/ppl__tests__star.ir.snap index 24258b61..f4f8c07c 100644 --- a/src/syntax/tests/snapshots/ppl__syntax__tests__star.ir.snap +++ b/src/tests/snapshots/ppl__tests__star.ir.snap @@ -1,9 +1,9 @@ --- -source: src/syntax/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'star' -source_filename = "star.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/star/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -32,7 +32,7 @@ declare %String @string_from_c_string_and_length(ptr, i64) declare %Integer @integer_from_i64(i64) -define void @star.execute() !dbg !9 { +define void @main.execute() !dbg !9 { init_globals: call void @initialize(), !dbg !10 br label %0, !dbg !10 @@ -75,14 +75,14 @@ declare %Integer @integer_star_integer(%Integer, %Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "star.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/star/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} !6 = !DIBasicType(name: "i32", size: 32, encoding: DW_ATE_signed) !7 = !DILocation(line: 0, column: 17, scope: !3) !8 = !DILocation(line: 0, scope: !3) -!9 = distinct !DISubprogram(name: "star.execute", linkageName: "star.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!9 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !10 = !DILocation(line: 0, column: 17, scope: !9) !11 = !DILocation(line: 0, column: 8, scope: !9) !12 = !DILocation(line: 0, column: 12, scope: !9) diff --git a/src/tests/snapshots/ppl__tests__star.run.snap b/src/tests/snapshots/ppl__tests__star.run.snap new file mode 100644 index 00000000..5097f8fb --- /dev/null +++ b/src/tests/snapshots/ppl__tests__star.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +6 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__string.hir.snap b/src/tests/snapshots/ppl__tests__string.hir.snap similarity index 89% rename from src/semantics/tests/snapshots/ppl__semantics__tests__string.hir.snap rename to src/tests/snapshots/ppl__tests__string.hir.snap index 77c701b0..e50bae95 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__string.hir.snap +++ b/src/tests/snapshots/ppl__tests__string.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- println "Hello" + " " + "World!" diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__string.ir.snap b/src/tests/snapshots/ppl__tests__string.ir.snap similarity index 95% rename from src/semantics/tests/snapshots/ppl__semantics__tests__string.ir.snap rename to src/tests/snapshots/ppl__tests__string.ir.snap index 340d0bb8..9eafd917 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__string.ir.snap +++ b/src/tests/snapshots/ppl__tests__string.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'string' -source_filename = "string.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/string/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -75,7 +75,7 @@ return: ; preds = %0 ret void } -define void @string.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 call void @initialize.1(), !dbg !17 @@ -160,7 +160,7 @@ return: ; preds = %1 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "string.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/string/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -173,7 +173,7 @@ return: ; preds = %1 !12 = distinct !DISubprogram(name: "initialize.2", linkageName: "initialize.2", scope: !2, file: !2, line: 7, type: !4, spFlags: DISPFlagDefinition, unit: !1) !13 = !DILocation(line: 7, column: 21, scope: !12) !14 = !DILocation(line: 0, scope: !12) -!15 = distinct !DISubprogram(name: "string.execute", linkageName: "string.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 7, column: 36, scope: !15) !17 = !DILocation(line: 6, column: 21, scope: !15) !18 = !DILocation(line: 7, column: 21, scope: !15) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__string.run.snap b/src/tests/snapshots/ppl__tests__string.run.snap similarity index 71% rename from src/semantics/tests/snapshots/ppl__semantics__tests__string.run.snap rename to src/tests/snapshots/ppl__tests__string.run.snap index 3334cae7..95811f20 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__string.run.snap +++ b/src/tests/snapshots/ppl__tests__string.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- Hello World! diff --git a/src/tests/snapshots/ppl__tests__supertraits.ir.snap b/src/tests/snapshots/ppl__tests__supertraits.ir.snap index 802baee1..ecc392e5 100644 --- a/src/tests/snapshots/ppl__tests__supertraits.ir.snap +++ b/src/tests/snapshots/ppl__tests__supertraits.ir.snap @@ -2,8 +2,8 @@ source: src/tests/mod.rs expression: ir --- -; ModuleID = 'supertraits' -source_filename = "supertraits.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/supertraits/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -56,7 +56,7 @@ return: ; preds = %0 declare void @"println <:String>"(%String) -define void @supertraits.execute() !dbg !13 { +define void @main.execute() !dbg !13 { init_globals: call void @initialize(), !dbg !14 br label %0, !dbg !14 @@ -83,7 +83,7 @@ return: ; preds = %0 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "supertraits.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/supertraits/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 15, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -94,7 +94,7 @@ return: ; preds = %0 !10 = !DILocation(line: 8, column: 24, scope: !9) !11 = distinct !DISubprogram(name: "bar <:None>", linkageName: "bar <:None>", scope: !2, file: !2, line: 9, type: !4, spFlags: DISPFlagDefinition, unit: !1) !12 = !DILocation(line: 9, column: 26, scope: !11) -!13 = distinct !DISubprogram(name: "supertraits.execute", linkageName: "supertraits.execute", scope: !2, file: !2, line: 15, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!13 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 15, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 15, column: 11, scope: !13) !15 = !DILocation(line: 15, column: 7, scope: !13) !16 = distinct !DISubprogram(name: "foobar <:None>", linkageName: "foobar <:None>", scope: !13, file: !2, line: 11, type: !4, spFlags: DISPFlagDefinition, unit: !1) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.hir.snap b/src/tests/snapshots/ppl__tests__traits.hir.snap similarity index 86% rename from src/semantics/tests/snapshots/ppl__semantics__tests__traits.hir.snap rename to src/tests/snapshots/ppl__tests__traits.hir.snap index b010fc1f..a514b915 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.hir.snap +++ b/src/tests/snapshots/ppl__tests__traits.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- trait Test: diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.ir.snap b/src/tests/snapshots/ppl__tests__traits.ir.snap similarity index 91% rename from src/semantics/tests/snapshots/ppl__semantics__tests__traits.ir.snap rename to src/tests/snapshots/ppl__tests__traits.ir.snap index 730e5597..6bba1e42 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__traits.ir.snap +++ b/src/tests/snapshots/ppl__tests__traits.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'traits' -source_filename = "traits.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/traits/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -65,7 +65,7 @@ return: ; preds = %1 ret %Integer %3 } -define void @traits.execute() !dbg !15 { +define void @main.execute() !dbg !15 { init_globals: call void @initialize(), !dbg !16 call void @initialize.1(), !dbg !17 @@ -104,7 +104,7 @@ declare %Integer @clone_integer(%Integer) !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "traits.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/traits/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 10, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -117,7 +117,7 @@ declare %Integer @clone_integer(%Integer) !12 = !DILocation(line: 9, column: 18, scope: !11) !13 = distinct !DISubprogram(name: "default <:Integer>", linkageName: "default <:Integer>", scope: !11, file: !2, line: 3, type: !4, spFlags: DISPFlagDefinition, unit: !1) !14 = !DILocation(line: 3, column: 25, scope: !13) -!15 = distinct !DISubprogram(name: "traits.execute", linkageName: "traits.execute", scope: !2, file: !2, line: 10, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!15 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 10, type: !4, spFlags: DISPFlagDefinition, unit: !1) !16 = !DILocation(line: 10, column: 11, scope: !15) !17 = !DILocation(line: 9, column: 10, scope: !15) !18 = !DILocation(line: 10, column: 8, scope: !15) diff --git a/src/tests/snapshots/ppl__tests__traits.run.snap b/src/tests/snapshots/ppl__tests__traits.run.snap new file mode 100644 index 00000000..6beaae09 --- /dev/null +++ b/src/tests/snapshots/ppl__tests__traits.run.snap @@ -0,0 +1,5 @@ +--- +source: src/tests/mod.rs +expression: run_log +--- +1 diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.hir.snap b/src/tests/snapshots/ppl__tests__type_as_value.hir.snap similarity index 92% rename from src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.hir.snap rename to src/tests/snapshots/ppl__tests__type_as_value.hir.snap index 94390bb3..ca880bbc 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.hir.snap +++ b/src/tests/snapshots/ppl__tests__type_as_value.hir.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let x: Type = (Type:Type) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.ir.snap b/src/tests/snapshots/ppl__tests__type_as_value.ir.snap similarity index 97% rename from src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.ir.snap rename to src/tests/snapshots/ppl__tests__type_as_value.ir.snap index bf0617bd..3b4a991f 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.ir.snap +++ b/src/tests/snapshots/ppl__tests__type_as_value.ir.snap @@ -1,9 +1,9 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'type_as_value' -source_filename = "type_as_value.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/type_as_value/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -131,7 +131,7 @@ return: ; preds = %0 declare %Integer @clone_integer(%Integer) -define void @type_as_value.execute() !dbg !25 { +define void @main.execute() !dbg !25 { init_globals: call void @initialize(), !dbg !26 call void @initialize.1(), !dbg !27 @@ -292,7 +292,7 @@ return: ; preds = %1 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "type_as_value.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/type_as_value/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 8, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -315,7 +315,7 @@ return: ; preds = %1 !22 = !DILocation(line: 5, column: 8, scope: !21) !23 = distinct !DISubprogram(name: "initialize.6", linkageName: "initialize.6", scope: !2, file: !2, line: 6, type: !4, spFlags: DISPFlagDefinition, unit: !1) !24 = !DILocation(line: 6, column: 8, scope: !23) -!25 = distinct !DISubprogram(name: "type_as_value.execute", linkageName: "type_as_value.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!25 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, type: !4, spFlags: DISPFlagDefinition, unit: !1) !26 = !DILocation(line: 8, column: 15, scope: !25) !27 = !DILocation(line: 5, column: 8, scope: !25) !28 = !DILocation(line: 0, column: 17, scope: !25) diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.run.snap b/src/tests/snapshots/ppl__tests__type_as_value.run.snap similarity index 66% rename from src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.run.snap rename to src/tests/snapshots/ppl__tests__type_as_value.run.snap index 5ba4e67b..2268b917 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__type_as_value.run.snap +++ b/src/tests/snapshots/ppl__tests__type_as_value.run.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- true diff --git a/src/ir/tests/snapshots/ppl__ir__tests__type_of.hir.snap b/src/tests/snapshots/ppl__tests__type_of.hir.snap similarity index 75% rename from src/ir/tests/snapshots/ppl__ir__tests__type_of.hir.snap rename to src/tests/snapshots/ppl__tests__type_of.hir.snap index c62af582..e2114dd8 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__type_of.hir.snap +++ b/src/tests/snapshots/ppl__tests__type_of.hir.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: hir --- let ty: Type = type of 1 diff --git a/src/ir/tests/snapshots/ppl__ir__tests__type_of.ir.snap b/src/tests/snapshots/ppl__tests__type_of.ir.snap similarity index 93% rename from src/ir/tests/snapshots/ppl__ir__tests__type_of.ir.snap rename to src/tests/snapshots/ppl__tests__type_of.ir.snap index 4d3a95cf..e05106f0 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__type_of.ir.snap +++ b/src/tests/snapshots/ppl__tests__type_of.ir.snap @@ -1,9 +1,9 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: ir --- -; ModuleID = 'type_of' -source_filename = "type_of.ppl" +; ModuleID = 'main' +source_filename = "/Users/gavrilikhin_d/Code/ppl/src/tests/type_of/src/main.ppl" %"Type" = type { %String, %Integer } %String = type { ptr } @@ -73,7 +73,7 @@ return: ; preds = %1 ret %"Type" %3 } -define void @type_of.execute() !dbg !16 { +define void @main.execute() !dbg !16 { init_globals: call void @initialize(), !dbg !17 call void @initialize.1(), !dbg !17 @@ -122,7 +122,7 @@ return: ; preds = %1 !0 = !{i32 2, !"Debug Info Version", i32 3} !1 = distinct !DICompileUnit(language: DW_LANG_C, file: !2, producer: "ppl", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, sysroot: "/") -!2 = !DIFile(filename: "type_of.ppl", directory: ".") +!2 = !DIFile(filename: "/Users/gavrilikhin_d/Code/ppl/src/tests/type_of/src/main.ppl", directory: ".") !3 = distinct !DISubprogram(name: "initialize", linkageName: "initialize", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !4 = !DISubroutineType(types: !5) !5 = !{!6} @@ -136,7 +136,7 @@ return: ; preds = %1 !13 = !DILocation(line: 0, column: 19, scope: !12) !14 = distinct !DISubprogram(name: "type of <:Integer>", linkageName: "type of <:Integer>", scope: !12, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !15 = !DILocation(line: 1, column: 10, scope: !14) -!16 = distinct !DISubprogram(name: "type_of.execute", linkageName: "type_of.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) +!16 = distinct !DISubprogram(name: "main.execute", linkageName: "main.execute", scope: !2, file: !2, line: 1, type: !4, spFlags: DISPFlagDefinition, unit: !1) !17 = !DILocation(line: 1, column: 10, scope: !16) !18 = !DILocation(line: 0, column: 9, scope: !16) !19 = !DILocation(line: 1, column: 8, scope: !16) diff --git a/src/ir/tests/snapshots/ppl__ir__tests__type_of.run.snap b/src/tests/snapshots/ppl__tests__type_of.run.snap similarity index 56% rename from src/ir/tests/snapshots/ppl__ir__tests__type_of.run.snap rename to src/tests/snapshots/ppl__tests__type_of.run.snap index 89c65a31..24d54562 100644 --- a/src/ir/tests/snapshots/ppl__ir__tests__type_of.run.snap +++ b/src/tests/snapshots/ppl__tests__type_of.run.snap @@ -1,5 +1,5 @@ --- -source: src/ir/tests/mod.rs +source: src/tests/mod.rs expression: run_log --- Integer diff --git a/src/semantics/tests/snapshots/ppl__semantics__tests__wrong_initializer_type.error.snap b/src/tests/snapshots/ppl__tests__wrong_initializer_type.error.snap similarity index 76% rename from src/semantics/tests/snapshots/ppl__semantics__tests__wrong_initializer_type.error.snap rename to src/tests/snapshots/ppl__tests__wrong_initializer_type.error.snap index 89202d50..b969dad0 100644 --- a/src/semantics/tests/snapshots/ppl__semantics__tests__wrong_initializer_type.error.snap +++ b/src/tests/snapshots/ppl__tests__wrong_initializer_type.error.snap @@ -1,5 +1,5 @@ --- -source: src/semantics/tests/mod.rs +source: src/tests/mod.rs expression: err --- Error: semantics::type_mismatch @@ -7,7 +7,7 @@ Error: semantics::type_mismatch × expected `Integer` type, got `String` Error: × Integer - ╭─[wrong_initializer_type.ppl:2:2] + ╭─[main.ppl:2:2] 1 │ type Point: 2 │ x: Integer · ┬ @@ -15,7 +15,7 @@ Error: × Integer 3 │ ╰──── Error: × String - ╭─[wrong_initializer_type.ppl:4:12] + ╭─[main.ppl:4:12] 3 │ 4 │ Point { x: "" } · ─┬ diff --git a/src/semantics/tests/specify_variable_ty/specify_variable_ty.ppl b/src/tests/specify_variable_ty/src/main.ppl similarity index 100% rename from src/semantics/tests/specify_variable_ty/specify_variable_ty.ppl rename to src/tests/specify_variable_ty/src/main.ppl diff --git a/src/syntax/tests/star/star.ppl b/src/tests/star/src/main.ppl similarity index 100% rename from src/syntax/tests/star/star.ppl rename to src/tests/star/src/main.ppl diff --git a/src/semantics/tests/string/string.ppl b/src/tests/string/src/main.ppl similarity index 100% rename from src/semantics/tests/string/string.ppl rename to src/tests/string/src/main.ppl diff --git a/src/tests/supertraits/supertraits.ppl b/src/tests/supertraits/src/main.ppl similarity index 100% rename from src/tests/supertraits/supertraits.ppl rename to src/tests/supertraits/src/main.ppl diff --git a/src/semantics/tests/traits/traits.ppl b/src/tests/traits/src/main.ppl similarity index 100% rename from src/semantics/tests/traits/traits.ppl rename to src/tests/traits/src/main.ppl diff --git a/src/semantics/tests/type_as_value/type_as_value.ppl b/src/tests/type_as_value/src/main.ppl similarity index 100% rename from src/semantics/tests/type_as_value/type_as_value.ppl rename to src/tests/type_as_value/src/main.ppl diff --git a/src/ir/tests/type_of/type_of.ppl b/src/tests/type_of/src/main.ppl similarity index 100% rename from src/ir/tests/type_of/type_of.ppl rename to src/tests/type_of/src/main.ppl diff --git a/src/semantics/tests/wrong_initializer_type/wrong_initializer_type.ppl b/src/tests/wrong_initializer_type/src/main.ppl similarity index 100% rename from src/semantics/tests/wrong_initializer_type/wrong_initializer_type.ppl rename to src/tests/wrong_initializer_type/src/main.ppl