diff --git a/Cargo.lock b/Cargo.lock index 8c4ba59a..941a6816 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1745,7 +1745,6 @@ dependencies = [ name = "rue-diagnostic" version = "0.6.0" dependencies = [ - "derive_more", "thiserror 2.0.14", ] @@ -1838,13 +1837,13 @@ dependencies = [ "chialisp", "clvmr", "env_logger", + "indexmap", "rue-compiler", "rue-diagnostic", "rue-lir", "rue-options", "serde", "serde_yml", - "walkdir", ] [[package]] @@ -1921,15 +1920,6 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - [[package]] name = "scopeguard" version = "1.2.0" @@ -2514,16 +2504,6 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" @@ -2600,15 +2580,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - [[package]] name = "windows-link" version = "0.1.3" diff --git a/crates/rue-cli/src/main.rs b/crates/rue-cli/src/main.rs index 3f1af41f..aaa5cfb1 100644 --- a/crates/rue-cli/src/main.rs +++ b/crates/rue-cli/src/main.rs @@ -135,11 +135,16 @@ fn build(args: BuildArgs) -> Result<()> { let mut ctx = Compiler::new(project.options); let tree = FileTree::compile_path(&mut ctx, &project.entrypoint, &mut HashMap::new())?; + let base_path = if project.entrypoint.is_file() { + project.entrypoint.parent().unwrap().canonicalize()? + } else { + project.entrypoint.canonicalize()? + }; let mut codegen = true; for diagnostic in ctx.take_diagnostics() { - let message = diagnostic.message(); + let message = diagnostic.message(&base_path); let severity = diagnostic.kind.severity(); if severity == DiagnosticSeverity::Error { @@ -156,7 +161,13 @@ fn build(args: BuildArgs) -> Result<()> { let program = if let Some(export) = args.export { let Some(program) = tree - .exports(&mut ctx, &mut allocator, file_kind.as_ref(), Some(&export))? + .exports( + &mut ctx, + &mut allocator, + file_kind.as_ref(), + Some(&export), + &base_path, + )? .into_iter() .next() else { @@ -166,7 +177,7 @@ fn build(args: BuildArgs) -> Result<()> { program.ptr } else if let Some(main_kind) = main_kind - && let Some(ptr) = tree.main(&mut ctx, &mut allocator, &main_kind)? + && let Some(ptr) = tree.main(&mut ctx, &mut allocator, &main_kind, base_path)? { ptr } else { @@ -210,11 +221,16 @@ fn test(args: TestArgs) -> Result<()> { let mut ctx = Compiler::new(project.options); let tree = FileTree::compile_path(&mut ctx, &project.entrypoint, &mut HashMap::new())?; + let base_path = if project.entrypoint.is_file() { + project.entrypoint.parent().unwrap().canonicalize()? + } else { + project.entrypoint.canonicalize()? + }; let mut codegen = true; for diagnostic in ctx.take_diagnostics() { - let message = diagnostic.message(); + let message = diagnostic.message(&base_path); let severity = diagnostic.kind.severity(); if severity == DiagnosticSeverity::Error { @@ -229,7 +245,7 @@ fn test(args: TestArgs) -> Result<()> { process::exit(1); } - let tests = tree.tests(&mut ctx, &mut allocator, None, None)?; + let tests = tree.tests(&mut ctx, &mut allocator, None, None, &base_path)?; let len = tests.len(); diff --git a/crates/rue-compiler/src/compile/path.rs b/crates/rue-compiler/src/compile/path.rs index 84735595..87c4d0b3 100644 --- a/crates/rue-compiler/src/compile/path.rs +++ b/crates/rue-compiler/src/compile/path.rs @@ -362,6 +362,15 @@ where ); PathResult::Unresolved } + (PathResult::Symbol(symbol, _, _), PathKind::Symbol) => { + if let Symbol::Module(_) = ctx.symbol(symbol) { + ctx.diagnostic( + range, + DiagnosticKind::CannotReferenceModule(previous_name.unwrap()), + ); + } + value + } _ => value, } } diff --git a/crates/rue-compiler/src/file.rs b/crates/rue-compiler/src/file.rs index 48c470a9..b4a16718 100644 --- a/crates/rue-compiler/src/file.rs +++ b/crates/rue-compiler/src/file.rs @@ -1,7 +1,7 @@ use std::{ collections::{HashMap, HashSet}, fs, io, - path::Path, + path::{Path, PathBuf}, sync::Arc, }; @@ -32,7 +32,7 @@ pub enum Error { #[error("Codegen error: {0}")] Lir(#[from] rue_lir::Error), - #[error("Source not found in compilation unit: {0}")] + #[error("Source not found in compilation unit")] SourceNotFound(SourceKind), } @@ -58,14 +58,11 @@ pub enum FileTree { } impl FileTree { - pub fn compile_file(ctx: &mut Compiler, path: &Path, file_name: String) -> Result { + pub fn compile_file(ctx: &mut Compiler, path: &Path) -> Result { let tree = Self::File(File::new( ctx, "main".to_string(), - Source::new( - Arc::from(fs::read_to_string(path)?), - SourceKind::File(file_name), - ), + Source::new(Arc::from(fs::read_to_string(path)?), normalize_path(path)?), )); tree.compile(ctx); @@ -250,6 +247,7 @@ impl FileTree { ctx: &mut Compiler, allocator: &mut Allocator, path: &SourceKind, + base_path: PathBuf, ) -> Result, Error> { let tree = self .find(path) @@ -260,7 +258,7 @@ impl FileTree { return Ok(None); }; - Ok(Some(codegen(ctx, allocator, main)?)) + Ok(Some(codegen(ctx, allocator, main, base_path)?)) } pub fn exports( @@ -269,12 +267,21 @@ impl FileTree { allocator: &mut Allocator, path: Option<&SourceKind>, export_name: Option<&str>, + base_path: &Path, ) -> Result, Error> { let Some(path) = path else { return Ok(self .all_files() .iter() - .map(|file| self.exports(ctx, allocator, Some(&file.source.kind), export_name)) + .map(|file| { + self.exports( + ctx, + allocator, + Some(&file.source.kind), + export_name, + base_path, + ) + }) .collect::, Error>>()? .into_iter() .flatten() @@ -301,7 +308,7 @@ impl FileTree { continue; } - let ptr = codegen(ctx, allocator, symbol)?; + let ptr = codegen(ctx, allocator, symbol, base_path.to_path_buf())?; exports.push(CompiledExport { name, symbol, ptr }); } @@ -314,6 +321,7 @@ impl FileTree { allocator: &mut Allocator, path: Option<&SourceKind>, search_term: Option<&str>, + base_path: &Path, ) -> Result, Error> { let tests = ctx .tests() @@ -340,7 +348,7 @@ impl FileTree { let mut outputs = Vec::new(); for test in tests { - let ptr = codegen(ctx, allocator, test.symbol)?; + let ptr = codegen(ctx, allocator, test.symbol, base_path.to_path_buf())?; outputs.push(CompiledTest { name: test.name, path: test.path, @@ -635,12 +643,13 @@ fn codegen( ctx: &mut Compiler, allocator: &mut Allocator, symbol: SymbolId, + base_path: PathBuf, ) -> Result { let options = *ctx.options(); let graph = DependencyGraph::build(ctx, symbol, options); let mut arena = Arena::new(); - let mut lowerer = Lowerer::new(ctx, &mut arena, &graph, options, symbol); + let mut lowerer = Lowerer::new(ctx, &mut arena, &graph, options, symbol, base_path); let mut lir = lowerer.lower_symbol_value(&Environment::default(), symbol); if options.optimize_lir { diff --git a/crates/rue-diagnostic/Cargo.toml b/crates/rue-diagnostic/Cargo.toml index e5757cb8..470cbd7b 100644 --- a/crates/rue-diagnostic/Cargo.toml +++ b/crates/rue-diagnostic/Cargo.toml @@ -16,4 +16,3 @@ workspace = true [dependencies] thiserror = { workspace = true } -derive_more = { workspace = true, features = ["display"] } diff --git a/crates/rue-diagnostic/src/diagnostic.rs b/crates/rue-diagnostic/src/diagnostic.rs index 77c31f4b..306e2d72 100644 --- a/crates/rue-diagnostic/src/diagnostic.rs +++ b/crates/rue-diagnostic/src/diagnostic.rs @@ -1,3 +1,5 @@ +use std::path::Path; + use crate::{DiagnosticKind, LineCol, SrcLoc}; #[derive(Debug, Clone)] @@ -19,9 +21,14 @@ impl Diagnostic { self.srcloc.end() } - pub fn message(&self) -> String { + pub fn message(&self, relative_to: &Path) -> String { let start = self.start(); - format!("{} at {}:{}", self.kind, self.srcloc.source.kind, start) + format!( + "{} at {}:{}", + self.kind, + self.srcloc.source.kind.display(relative_to), + start + ) } } diff --git a/crates/rue-diagnostic/src/kind.rs b/crates/rue-diagnostic/src/kind.rs index d12aa180..6e19d145 100644 --- a/crates/rue-diagnostic/src/kind.rs +++ b/crates/rue-diagnostic/src/kind.rs @@ -129,6 +129,9 @@ pub enum DiagnosticKind { #[error("Expected type, but found symbol `{0}`")] ExpectedType(String), + #[error("Cannot reference module `{0}`")] + CannotReferenceModule(String), + #[error("Generic arguments are not permitted on symbol references")] GenericArgumentsOnSymbolReference, @@ -269,6 +272,7 @@ impl DiagnosticKind { | Self::PrivateType(..) | Self::ExpectedSymbol(..) | Self::ExpectedType(..) + | Self::CannotReferenceModule(..) | Self::GenericArgumentsOnSymbolReference | Self::NonStructInitializer(..) | Self::MissingRequiredFields(..) diff --git a/crates/rue-diagnostic/src/srcloc.rs b/crates/rue-diagnostic/src/srcloc.rs index 29e59e85..46688bcb 100644 --- a/crates/rue-diagnostic/src/srcloc.rs +++ b/crates/rue-diagnostic/src/srcloc.rs @@ -1,6 +1,4 @@ -use std::{fmt, ops::Range, sync::Arc}; - -use derive_more::Display; +use std::{ops::Range, path::Path, sync::Arc}; use crate::LineCol; @@ -16,12 +14,9 @@ impl Source { } } -#[derive(Debug, Clone, Display, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum SourceKind { - #[display("std")] Std, - - #[display("{_0}")] File(String), } @@ -32,6 +27,15 @@ impl SourceKind { Self::File(_) => true, } } + + pub fn display(&self, relative_to: &Path) -> String { + match self { + Self::Std => "std".to_string(), + Self::File(path) => Path::new(path) + .strip_prefix(relative_to) + .map_or_else(|_| path.clone(), |path| path.to_string_lossy().to_string()), + } + } } #[derive(Debug, Clone)] @@ -52,10 +56,8 @@ impl SrcLoc { pub fn end(&self) -> LineCol { LineCol::new(&self.source.text, self.span.end) } -} -impl fmt::Display for SrcLoc { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}:{}", self.source.kind, self.start()) + pub fn display(&self, relative_to: &Path) -> String { + format!("{}:{}", self.source.kind.display(relative_to), self.start()) } } diff --git a/crates/rue-hir/src/lower.rs b/crates/rue-hir/src/lower.rs index ef72e520..a8bce4e8 100644 --- a/crates/rue-hir/src/lower.rs +++ b/crates/rue-hir/src/lower.rs @@ -1,6 +1,6 @@ #![allow(clippy::needless_pass_by_value)] -use std::{collections::HashMap, mem}; +use std::{collections::HashMap, mem, path::PathBuf}; use id_arena::Arena; use indexmap::{IndexMap, IndexSet}; @@ -38,6 +38,7 @@ pub struct Lowerer<'d, 'a, 'g> { inline_symbols: Vec>, options: CompilerOptions, main: SymbolId, + base_path: PathBuf, } impl<'d, 'a, 'g> Lowerer<'d, 'a, 'g> { @@ -47,6 +48,7 @@ impl<'d, 'a, 'g> Lowerer<'d, 'a, 'g> { graph: &'g DependencyGraph, options: CompilerOptions, main: SymbolId, + base_path: PathBuf, ) -> Self { Self { db, @@ -55,6 +57,7 @@ impl<'d, 'a, 'g> Lowerer<'d, 'a, 'g> { inline_symbols: Vec::new(), options, main, + base_path, } } @@ -704,7 +707,9 @@ impl<'d, 'a, 'g> Lowerer<'d, 'a, 'g> { } let value = self.lower_hir(env, value); - let print = self.arena.alloc(Lir::DebugPrint(srcloc.to_string(), value)); + let print = self + .arena + .alloc(Lir::DebugPrint(srcloc.display(&self.base_path), value)); let nil = self.arena.alloc(Lir::Atom(vec![])); self.arena.alloc(Lir::If(print, nil, rest, false)) } diff --git a/crates/rue-parser/src/grammar.rs b/crates/rue-parser/src/grammar.rs index 5ba987db..a6f6fd1c 100644 --- a/crates/rue-parser/src/grammar.rs +++ b/crates/rue-parser/src/grammar.rs @@ -11,7 +11,7 @@ pub(crate) use document::document; #[cfg(test)] mod tests { - use std::sync::Arc; + use std::{path::Path, sync::Arc}; use expect_test::Expect; use rue_diagnostic::{Source, SourceKind}; @@ -38,7 +38,7 @@ mod tests { if i != 0 { error_output.push('\n'); } - error_output.push_str(&error.message()); + error_output.push_str(&error.message(Path::new("."))); } expect.assert_eq(&output); diff --git a/crates/rue-tests/Cargo.toml b/crates/rue-tests/Cargo.toml index b97ae18e..9412a5f2 100644 --- a/crates/rue-tests/Cargo.toml +++ b/crates/rue-tests/Cargo.toml @@ -24,6 +24,6 @@ clvmr = { workspace = true } chialisp = { workspace = true } anyhow = { workspace = true } serde = { workspace = true } -walkdir = { workspace = true } serde_yml = { workspace = true } env_logger = { workspace = true } +indexmap = { workspace = true } diff --git a/crates/rue-tests/src/main.rs b/crates/rue-tests/src/main.rs index ba354480..c2a55bdf 100644 --- a/crates/rue-tests/src/main.rs +++ b/crates/rue-tests/src/main.rs @@ -1,3 +1,4 @@ +use std::collections::HashMap; use std::env; use std::fs; use std::path::Path; @@ -10,12 +11,13 @@ use clvmr::{ Allocator, ChiaDialect, ENABLE_KECCAK_OPS_OUTSIDE_GUARD, MEMPOOL_MODE, NodePtr, run_program, serde::node_to_bytes, }; +use indexmap::IndexMap; +use rue_compiler::normalize_path; use rue_compiler::{Compiler, FileTree}; -use rue_diagnostic::{DiagnosticSeverity, SourceKind}; +use rue_diagnostic::DiagnosticSeverity; use rue_lir::DebugDialect; use rue_options::CompilerOptions; use serde::{Deserialize, Serialize}; -use walkdir::{DirEntry, WalkDir}; #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize)] #[serde(default)] @@ -76,7 +78,7 @@ fn main() -> Result<()> { let args: Vec = env::args().collect(); let filter_arg = args.get(1).cloned(); - let failed = run_tests(filter_arg.as_deref(), ".", true)?; + let failed = run_tests(filter_arg.as_deref(), Path::new("."), true)?; if failed { process::exit(1); @@ -85,16 +87,31 @@ fn main() -> Result<()> { Ok(()) } -fn run_tests(filter_arg: Option<&str>, base_path: &str, update: bool) -> Result { +fn run_tests(filter_arg: Option<&str>, base_path: &Path, update: bool) -> Result { let mut failed = false; - for entry in WalkDir::new(Path::new(base_path).join("tests")) - .into_iter() - .chain(WalkDir::new(Path::new(base_path).join("examples")).into_iter()) - { + walk_dir(&base_path.join("tests"), filter_arg, update, &mut failed)?; + walk_dir(&base_path.join("examples"), filter_arg, update, &mut failed)?; + + Ok(failed) +} + +fn walk_dir(path: &Path, filter_arg: Option<&str>, update: bool, failed: &mut bool) -> Result<()> { + let mut directories = IndexMap::new(); + + for entry in fs::read_dir(path)? { let entry = entry?; + let path = entry.path(); - if let Some(name) = entry.file_name().to_str().unwrap().strip_suffix(".rue") { + if path.is_dir() { + directories.insert(entry.file_name().to_string_lossy().to_string(), path); + continue; + } + + let file_name = entry.file_name(); + let file_name = file_name.to_str().unwrap(); + + if let Some(name) = file_name.strip_suffix(".rue") { if !entry .path() .parent() @@ -102,15 +119,28 @@ fn run_tests(filter_arg: Option<&str>, base_path: &str, update: bool) -> Result< .join(format!("{name}.yaml")) .try_exists()? { - handle_test_file(name, &entry, &mut failed, update)?; + handle_test_file(name, &entry.path(), failed, update, false)?; } continue; } - let Some(name) = entry.file_name().to_str().unwrap().strip_suffix(".yaml") else { + let Some(name) = file_name.strip_suffix(".yaml") else { continue; }; + let mut is_dir = false; + + if !entry + .path() + .parent() + .unwrap() + .join(format!("{name}.rue")) + .try_exists()? + { + directories.shift_remove(name); + is_dir = true; + } + // If a filter argument is provided, skip tests that don't contain it if let Some(ref filter) = filter_arg && !name.contains(filter) @@ -118,16 +148,25 @@ fn run_tests(filter_arg: Option<&str>, base_path: &str, update: bool) -> Result< continue; } - handle_test_file(name, &entry, &mut failed, update)?; + handle_test_file(name, &entry.path(), failed, update, is_dir)?; } - Ok(failed) + for (_, path) in directories { + walk_dir(&path, filter_arg, update, failed)?; + } + + Ok(()) } -fn handle_test_file(name: &str, entry: &DirEntry, failed: &mut bool, update: bool) -> Result<()> { - let parent = entry.path().parent().unwrap(); +fn handle_test_file( + name: &str, + entry: &Path, + failed: &mut bool, + update: bool, + is_dir: bool, +) -> Result<()> { + let parent = entry.parent().unwrap(); let yaml_file = parent.join(format!("{name}.yaml")); - let rue_file = parent.join(format!("{name}.rue")); println!("Running {name}"); @@ -144,16 +183,26 @@ fn handle_test_file(name: &str, entry: &DirEntry, failed: &mut bool, update: boo let mut ctx = Compiler::new(CompilerOptions::default()); let mut debug_ctx = Compiler::new(CompilerOptions::debug()); - let unit = FileTree::compile_file(&mut ctx, &rue_file, "test".to_string())?; - let debug_unit = FileTree::compile_file(&mut debug_ctx, &rue_file, "test".to_string())?; - let kind = SourceKind::File("test".to_string()); + let (unit, debug_unit, kind, base_path) = if is_dir { + let rue_dir = parent.join(name); + let unit = FileTree::compile_path(&mut ctx, &rue_dir, &mut HashMap::new())?; + let debug_unit = FileTree::compile_path(&mut debug_ctx, &rue_dir, &mut HashMap::new())?; + let kind = normalize_path(&rue_dir.join("main.rue"))?; + (unit, debug_unit, kind, rue_dir.canonicalize()?) + } else { + let rue_file = parent.join(format!("{name}.rue")); + let unit = FileTree::compile_file(&mut ctx, &rue_file)?; + let debug_unit = FileTree::compile_file(&mut debug_ctx, &rue_file)?; + let kind = normalize_path(&rue_file)?; + (unit, debug_unit, kind, parent.canonicalize()?) + }; file.diagnostics = Vec::new(); let mut codegen = true; for diagnostic in ctx.take_diagnostics() { - file.diagnostics.push(diagnostic.message()); + file.diagnostics.push(diagnostic.message(&base_path)); if diagnostic.kind.severity() == DiagnosticSeverity::Error { codegen = false; @@ -161,20 +210,20 @@ fn handle_test_file(name: &str, entry: &DirEntry, failed: &mut bool, update: boo } let main = codegen - .then(|| unit.main(&mut ctx, &mut allocator, &kind)) + .then(|| unit.main(&mut ctx, &mut allocator, &kind, base_path.clone())) .transpose()? .flatten(); let debug_main = codegen - .then(|| debug_unit.main(&mut debug_ctx, &mut allocator, &kind)) + .then(|| debug_unit.main(&mut debug_ctx, &mut allocator, &kind, base_path.clone())) .transpose()? .flatten(); let tests = codegen - .then(|| unit.tests(&mut ctx, &mut allocator, None, None)) + .then(|| unit.tests(&mut ctx, &mut allocator, None, None, &base_path)) .transpose()? .unwrap_or_default(); let debug_tests = codegen - .then(|| debug_unit.tests(&mut debug_ctx, &mut allocator, None, None)) + .then(|| debug_unit.tests(&mut debug_ctx, &mut allocator, None, None, &base_path)) .transpose()? .unwrap_or_default(); @@ -313,7 +362,7 @@ mod tests { #[test] fn tests() -> Result<()> { - let failed = run_tests(None, "../..", false)?; + let failed = run_tests(None, Path::new("../.."), false)?; assert!(!failed); diff --git a/examples/brainfck.yaml b/examples/brainfck.yaml index 32688006..3e7f3238 100644 --- a/examples/brainfck.yaml +++ b/examples/brainfck.yaml @@ -1,7 +1,7 @@ tests: - name: abc program: (a (q 5 (r (r (f (a 12 (c (c 8 (c 12 (c 22 30))) (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (a 10 (c 10 (c (q . 43) (q . 65)))) (q . ".+.+.")) ())))))))) (c (c (c (q 2 (i 7 (q 2 (q 16 (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1) (q . 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1)) (q)) 1) (q 2 (i 11 (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3)))) (q . 3)) 1)) (c (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1) (c (q 2 (i 17 (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7))) (q . 5)) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ 35 (q . 1)) (c 83 (c -77 ()))) (c 43 (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- 35 (q . 1)) (c 83 (c -77 ()))) (c 43 (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i 83 (q 4 (c -109 (c -45 (c (c 35 -77) ()))) (c 43 (c 91 ()))) (q 4 (c () (c () (c (c 35 -77) ()))) (c 43 (c 91 ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i -77 (q 4 (c 307 (c (c 35 83) (c 435 ()))) (c 43 (c 91 ()))) (q 4 (c () (c (c 35 83) (c () ()))) (c 43 (c 91 ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr 43 () (q . 1)) (c 83 (c -77 ()))) (c (substr 43 (q . 1)) (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c 19 (c 43 (c (concat 91 35) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 4 (a 91 (c (c 19 (c 43 (c 91 123))) (c 23 (substr 9 () 2)))) (c (substr 9 2) ())) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 11 (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr 11 (q . 1)) (substr 11 () (q . 1))) 1))))) ())) - debug_program: (a (q 2 (q 2 (q 2 (i ("debug_print" (q . "test:207:5") (concat (concat (concat (concat (concat (concat (q . "run(`") (concat (a 43 (c 43 (c (q . 43) (q . 65)))) (q . ".+.+."))) (q . "`, `")) ()) (q . "`) = `")) 2) (q . 96))) (q) (q . 2)) 1) (c (f (r (r (f (a 25 (c (c 17 (c 25 (c 45 61))) 2)))))) 1)) (c (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (a 10 (c 10 (c (q . 43) (q . 65)))) (q . ".+.+.")) ())) 1)) (c (c (c (q 2 (i (= 7 ()) (q) (q 2 (q 16 (q . 1) (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1))) 1) (q 2 (i (= (f (r 3)) ()) (q . 3) (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3))))) 1)) (c (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1) (c (q 2 (i (= (f (f 5)) ()) (q . 5) (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7)))) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i (not (l (f (r (f (f 7)))))) (q 4 (c () (c () (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (f (f 7))))) (c (r (f (r (f (f 7))))) (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i (not (l (f (r (r (f (f 7))))))) (q 4 (c () (c (c (f (f (f 7))) (f (r (f (f 7))))) (c () ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (r (f (f 7)))))) (c (c (f (f (f 7))) (f (r (f (f 7))))) (c (r (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr (f (r (f 7))) () (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (substr (f (r (f 7))) (q . 1)) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c (f (f 7)) (c (f (r (f 7))) (c (concat (f (r (r (f 7)))) (f (f (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 2 (q 4 (a -73 (c (c 39 (c 87 (c -73 -9))) (c (f 31) 4))) (c 6 ())) (c (c (substr 9 () 2) (substr 9 2)) 1)) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 (f 7) (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr (f (r 3)) (q . 1)) (substr (f (r 3)) () (q . 1))) 1))))) ())) + debug_program: (a (q 2 (q 2 (q 2 (i ("debug_print" (q . "brainfck.rue:207:5") (concat (concat (concat (concat (concat (concat (q . "run(`") (concat (a 43 (c 43 (c (q . 43) (q . 65)))) (q . ".+.+."))) (q . "`, `")) ()) (q . "`) = `")) 2) (q . 96))) (q) (q . 2)) 1) (c (f (r (r (f (a 25 (c (c 17 (c 25 (c 45 61))) 2)))))) 1)) (c (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (a 10 (c 10 (c (q . 43) (q . 65)))) (q . ".+.+.")) ())) 1)) (c (c (c (q 2 (i (= 7 ()) (q) (q 2 (q 16 (q . 1) (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1))) 1) (q 2 (i (= (f (r 3)) ()) (q . 3) (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3))))) 1)) (c (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1) (c (q 2 (i (= (f (f 5)) ()) (q . 5) (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7)))) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i (not (l (f (r (f (f 7)))))) (q 4 (c () (c () (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (f (f 7))))) (c (r (f (r (f (f 7))))) (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i (not (l (f (r (r (f (f 7))))))) (q 4 (c () (c (c (f (f (f 7))) (f (r (f (f 7))))) (c () ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (r (f (f 7)))))) (c (c (f (f (f 7))) (f (r (f (f 7))))) (c (r (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr (f (r (f 7))) () (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (substr (f (r (f 7))) (q . 1)) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c (f (f 7)) (c (f (r (f 7))) (c (concat (f (r (r (f 7)))) (f (f (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 2 (q 4 (a -73 (c (c 39 (c 87 (c -73 -9))) (c (f 31) 4))) (c 6 ())) (c (c (substr 9 () 2) (substr 9 2)) 1)) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 (f 7) (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr (f (r 3)) (q . 1)) (substr (f (r 3)) () (q . 1))) 1))))) ())) output: '"ABC"' runtime_cost: 478061 byte_cost: 16872000 @@ -10,7 +10,7 @@ tests: - '"run(`+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.+.+.`, ``) = `ABC`"' - name: alphabet program: (a (q 5 (r (r (f (a 10 (c (c 8 (c 10 (c 22 30))) (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (q . 62) (a 12 (c 12 (c (q . 43) (q . 65)))) (q . 60) (a 12 (c 12 (c (q . 43) (q . 26)))) (q . "[->.+<]")) ())))))))) (c (c (c (q 2 (i 7 (q 2 (q 16 (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1) (q . 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1)) (q)) 1) (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1)) (c (q 2 (i 11 (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3)))) (q . 3)) 1) (c (q 2 (i 17 (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7))) (q . 5)) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ 35 (q . 1)) (c 83 (c -77 ()))) (c 43 (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- 35 (q . 1)) (c 83 (c -77 ()))) (c 43 (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i 83 (q 4 (c -109 (c -45 (c (c 35 -77) ()))) (c 43 (c 91 ()))) (q 4 (c () (c () (c (c 35 -77) ()))) (c 43 (c 91 ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i -77 (q 4 (c 307 (c (c 35 83) (c 435 ()))) (c 43 (c 91 ()))) (q 4 (c () (c (c 35 83) (c () ()))) (c 43 (c 91 ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr 43 () (q . 1)) (c 83 (c -77 ()))) (c (substr 43 (q . 1)) (c 91 ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c 19 (c 43 (c (concat 91 35) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 4 (a 91 (c (c 19 (c 43 (c 91 123))) (c 23 (substr 9 () 2)))) (c (substr 9 2) ())) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 11 (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr 11 (q . 1)) (substr 11 () (q . 1))) 1))))) ())) - debug_program: (a (q 2 (q 2 (q 2 (i ("debug_print" (q . "test:207:5") (concat (concat (concat (concat (concat (concat (q . "run(`") (concat (concat (concat (concat (q . 62) (a 51 (c 51 (c (q . 43) (q . 65))))) (q . 60)) (a 51 (c 51 (c (q . 43) (q . 26))))) (q . "[->.+<]"))) (q . "`, `")) ()) (q . "`) = `")) 2) (q . 96))) (q) (q . 2)) 1) (c (f (r (r (f (a 21 (c (c 17 (c 21 (c 45 61))) 2)))))) 1)) (c (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (concat (concat (concat (q . 62) (a 12 (c 12 (c (q . 43) (q . 65))))) (q . 60)) (a 12 (c 12 (c (q . 43) (q . 26))))) (q . "[->.+<]")) ())) 1)) (c (c (c (q 2 (i (= 7 ()) (q) (q 2 (q 16 (q . 1) (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1))) 1) (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1)) (c (q 2 (i (= (f (r 3)) ()) (q . 3) (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3))))) 1) (c (q 2 (i (= (f (f 5)) ()) (q . 5) (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7)))) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i (not (l (f (r (f (f 7)))))) (q 4 (c () (c () (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (f (f 7))))) (c (r (f (r (f (f 7))))) (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i (not (l (f (r (r (f (f 7))))))) (q 4 (c () (c (c (f (f (f 7))) (f (r (f (f 7))))) (c () ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (r (f (f 7)))))) (c (c (f (f (f 7))) (f (r (f (f 7))))) (c (r (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr (f (r (f 7))) () (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (substr (f (r (f 7))) (q . 1)) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c (f (f 7)) (c (f (r (f 7))) (c (concat (f (r (r (f 7)))) (f (f (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 2 (q 4 (a -73 (c (c 39 (c 87 (c -73 -9))) (c (f 31) 4))) (c 6 ())) (c (c (substr 9 () 2) (substr 9 2)) 1)) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 (f 7) (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr (f (r 3)) (q . 1)) (substr (f (r 3)) () (q . 1))) 1))))) ())) + debug_program: (a (q 2 (q 2 (q 2 (i ("debug_print" (q . "brainfck.rue:207:5") (concat (concat (concat (concat (concat (concat (q . "run(`") (concat (concat (concat (concat (q . 62) (a 51 (c 51 (c (q . 43) (q . 65))))) (q . 60)) (a 51 (c 51 (c (q . 43) (q . 26))))) (q . "[->.+<]"))) (q . "`, `")) ()) (q . "`) = `")) 2) (q . 96))) (q) (q . 2)) 1) (c (f (r (r (f (a 21 (c (c 17 (c 21 (c 45 61))) 2)))))) 1)) (c (c (c (c () (c () (c () ()))) (c () (c () ()))) (c (concat (concat (concat (concat (q . 62) (a 12 (c 12 (c (q . 43) (q . 65))))) (q . 60)) (a 12 (c 12 (c (q . 43) (q . 26))))) (q . "[->.+<]")) ())) 1)) (c (c (c (q 2 (i (= 7 ()) (q) (q 2 (q 16 (q . 1) (a (i (= 6 (q . 91)) (q 2 5 (c 5 (c (+ 11 (q . 1)) 4))) (q 2 (i (= 6 (q . 93)) (q 2 (i (= 11 (q . 1)) (q) (q 2 5 (c 5 (c (- 11 (q . 1)) 4)))) 1) (q 2 5 (c 5 (c 11 4)))) 1)) 1)) (c (c (substr 7 (q . 1)) (substr 7 () (q . 1))) 1))) 1) (q 2 (i (> 7 ()) (q 14 5 (a 2 (c 2 (c 5 (- 7 (q . 1)))))) (q)) 1)) (c (q 2 (i (= (f (r 3)) ()) (q . 3) (q 2 10 (c (c 4 (c 10 (c 22 30))) (a 30 (c (c 4 (c 10 (c 22 30))) 3))))) 1) (c (q 2 (i (= (f (f 5)) ()) (q . 5) (q 2 22 (c (c 4 (c 10 (c 22 30))) (c (f (a 10 (c (c 4 (c 10 (c 22 30))) (c 5 (c 7 ()))))) 7)))) 1) (q 2 (q 2 (i (= 6 (q . 43)) (q 4 (c (c (+ (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 45)) (q 4 (c (c (- (f (f (f 7))) (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 60)) (q 4 (a (i (not (l (f (r (f (f 7)))))) (q 4 (c () (c () (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (f (f 7))))) (c (r (f (r (f (f 7))))) (c (c (f (f (f 7))) (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 62)) (q 4 (a (i (not (l (f (r (r (f (f 7))))))) (q 4 (c () (c (c (f (f (f 7))) (f (r (f (f 7))))) (c () ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ()))) (q 4 (c (f (f (r (r (f (f 7)))))) (c (c (f (f (f 7))) (f (r (f (f 7))))) (c (r (f (r (r (f (f 7)))))) ()))) (c (f (r (f 7))) (c (f (r (r (f 7)))) ())))) 1) (c 4 ())) (q 2 (i (= 6 (q . 44)) (q 4 (c (c (substr (f (r (f 7))) () (q . 1)) (c (f (r (f (f 7)))) (c (f (r (r (f (f 7))))) ()))) (c (substr (f (r (f 7))) (q . 1)) (c (f (r (r (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 46)) (q 4 (c (f (f 7)) (c (f (r (f 7))) (c (concat (f (r (r (f 7)))) (f (f (f 7)))) ()))) (c 4 ())) (q 2 (i (= 6 (q . 91)) (q 2 (q 2 (q 4 (a -73 (c (c 39 (c 87 (c -73 -9))) (c (f 31) 4))) (c 6 ())) (c (c (substr 9 () 2) (substr 9 2)) 1)) (c (a 9 (c 9 (c (q . 1) 4))) 1)) (q 4 (f 7) (c 4 ()))) 1)) 1)) 1)) 1)) 1)) 1)) 1) (c (c (substr (f (r 3)) (q . 1)) (substr (f (r 3)) () (q . 1))) 1))))) ())) output: '"ABCDEFGHIJKLMNOPQRSTUVWXYZ"' runtime_cost: 1454359 byte_cost: 17280000 diff --git a/tests/blocks/improper_blocks.yaml b/tests/blocks/improper_blocks.yaml index ace19a2e..70f97378 100644 --- a/tests/blocks/improper_blocks.yaml +++ b/tests/blocks/improper_blocks.yaml @@ -1,11 +1,11 @@ diagnostics: -- Block does not return a value at test:3:36 -- Cannot assign `nil` to `Int` without a cast, since they are semantically different at test:3:36 -- Condition always evaluates to `true` at test:6:8 -- Block does not return a value at test:6:13 -- Condition always evaluates to `true` at test:10:8 -- Expected statement block to end in `return` or `raise`, not an expression at test:11:9 -- Cannot use a `return` statement here, end the block with an expression instead at test:16:5 -- Condition always evaluates to `true` at test:20:8 -- Cannot use a `return` statement here, end the block with an expression instead at test:21:9 -- Cannot use a `return` statement here, end the block with an expression instead at test:23:9 +- Block does not return a value at improper_blocks.rue:3:36 +- Cannot assign `nil` to `Int` without a cast, since they are semantically different at improper_blocks.rue:3:36 +- Condition always evaluates to `true` at improper_blocks.rue:6:8 +- Block does not return a value at improper_blocks.rue:6:13 +- Condition always evaluates to `true` at improper_blocks.rue:10:8 +- Expected statement block to end in `return` or `raise`, not an expression at improper_blocks.rue:11:9 +- Cannot use a `return` statement here, end the block with an expression instead at improper_blocks.rue:16:5 +- Condition always evaluates to `true` at improper_blocks.rue:20:8 +- Cannot use a `return` statement here, end the block with an expression instead at improper_blocks.rue:21:9 +- Cannot use a `return` statement here, end the block with an expression instead at improper_blocks.rue:23:9 diff --git a/tests/blocks/let_missing_value.yaml b/tests/blocks/let_missing_value.yaml index 1757b97e..1c9c8b58 100644 --- a/tests/blocks/let_missing_value.yaml +++ b/tests/blocks/let_missing_value.yaml @@ -1,5 +1,5 @@ diagnostics: -- Let bindings must have a value, since they cannot be reassigned at test:2:5 -- Let bindings must have a value, since they cannot be reassigned at test:3:5 -- Unused binding `missing` at test:2:9 -- Unused binding `with_type` at test:3:9 +- Let bindings must have a value, since they cannot be reassigned at let_missing_value.rue:2:5 +- Let bindings must have a value, since they cannot be reassigned at let_missing_value.rue:3:5 +- Unused binding `missing` at let_missing_value.rue:2:9 +- Unused binding `with_type` at let_missing_value.rue:3:9 diff --git a/tests/blocks/missing_return_type.yaml b/tests/blocks/missing_return_type.yaml index f28a84d0..323e603f 100644 --- a/tests/blocks/missing_return_type.yaml +++ b/tests/blocks/missing_return_type.yaml @@ -1,2 +1,2 @@ diagnostics: -- Cannot assign `42` to `nil`, since they are incompatible at test:7:22 +- Cannot assign `42` to `nil`, since they are incompatible at missing_return_type.rue:7:22 diff --git a/tests/debug/print.yaml b/tests/debug/print.yaml index 3bb95032..f6764135 100644 --- a/tests/debug/print.yaml +++ b/tests/debug/print.yaml @@ -1,7 +1,7 @@ tests: - name: single_print program: () - debug_program: (a (i ("debug_print" (q . "test:2:5") (q . "Hello, world!")) (q) (q)) 1) + debug_program: (a (i ("debug_print" (q . "print.rue:2:5") (q . "Hello, world!")) (q) (q)) 1) output: () runtime_cost: 44 byte_cost: 12000 @@ -10,7 +10,7 @@ tests: - '"Hello, world!"' - name: multiple_prints program: () - debug_program: (a (i ("debug_print" (q . "test:6:5") (q . 1)) (q) (q 2 (i ("debug_print" (q . "test:7:5") (q . 2)) (q) (q 2 (i ("debug_print" (q . "test:8:5") (q . 3)) (q) (q)) 1)) 1)) 1) + debug_program: (a (i ("debug_print" (q . "print.rue:6:5") (q . 1)) (q) (q 2 (i ("debug_print" (q . "print.rue:7:5") (q . 2)) (q) (q 2 (i ("debug_print" (q . "print.rue:8:5") (q . 3)) (q) (q)) 1)) 1)) 1) output: () runtime_cost: 44 byte_cost: 12000 @@ -21,7 +21,7 @@ tests: - '3' - name: print_recursive program: (a (q 2 2 (c 2 (c (q . 1) (c (q . 2) (c (q . 3) ()))))) (c (q 2 (i 3 (q 2 2 (c 2 7)) (q)) 1) ())) - debug_program: (a (q 3 (q . 1) () (a 2 (c 2 (c (q . 1) (c (q . 2) (c (q . 3) ())))))) (c (q 2 (i (not (l 3)) (q) (q 2 (i ("debug_print" (q . "test:20:5") (f 3)) (q) (q 3 (q . 1) () (a 2 (c 2 (r 3))))) 1)) 1) ())) + debug_program: (a (q 3 (q . 1) () (a 2 (c 2 (c (q . 1) (c (q . 2) (c (q . 3) ())))))) (c (q 2 (i (not (l 3)) (q) (q 2 (i ("debug_print" (q . "print.rue:20:5") (f 3)) (q) (q 3 (q . 1) () (a 2 (c 2 (r 3))))) 1)) 1) ())) output: () runtime_cost: 2663 byte_cost: 996000 @@ -32,7 +32,7 @@ tests: - '3' - name: print_with_assertions program: (a (q 3 (a 2 (c (q . "hello") ())) (a 2 (c (q . "goodbye") ())) (a 2 (c (q . "hello") (q . "world")))) (c (q 2 (i (l 1) (q 2 (i (l 2) (q 8) (q 2 (i (a (i (l 3) (q) (q 2 (i 3 (q) (q 1 . 1)) 1)) 1) (q) (q 8)) 1)) 1) (q 8)) 1) ())) - debug_program: (a (q 2 (i ("debug_print" (q . "test:26:5") (q . "First test")) (q) (q 3 (q . 1) (a (i ("debug_print" (q . "test:28:5") (q . "Second test")) (q) (q 3 (q . 1) (a (i ("debug_print" (q . "test:30:5") (q . "Third test")) (q) (q 3 (q . 1) () (a 2 (c (q . "hello") (q . "world"))))) 1) (a 2 (c (q . "goodbye") ())))) 1) (a 2 (c (q . "hello") ())))) 1) (c (q 2 (i ("debug_print" (q . "test:35:5") (q . "Asserting value is a pair")) (q) (q 2 (i (l 1) (q 2 (i ("debug_print" (q . "test:37:5") (q . "Asserting first is a string")) (q) (q 2 (i (not (l (f 1))) (q 2 (i ("debug_print" (q . "test:39:5") (q . "Asserting rest is nil")) (q) (q 2 (i ("debug_print" (q . "test:40:5") 1) (q) (q 2 (i (a (i (not (l (r 1))) (q 2 (i (= (r 1) ()) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i ("debug_print" (q . "test:42:5") (q . "Value is valid")) (q) (q)) 1) (q 8 (q . "assertion failed at 41:5"))) 1)) 1)) 1) (q 8 (q . "assertion failed at 38:5"))) 1)) 1) (q 8 (q . "assertion failed at 36:5"))) 1)) 1) ())) + debug_program: (a (q 2 (i ("debug_print" (q . "print.rue:26:5") (q . "First test")) (q) (q 3 (q . 1) (a (i ("debug_print" (q . "print.rue:28:5") (q . "Second test")) (q) (q 3 (q . 1) (a (i ("debug_print" (q . "print.rue:30:5") (q . "Third test")) (q) (q 3 (q . 1) () (a 2 (c (q . "hello") (q . "world"))))) 1) (a 2 (c (q . "goodbye") ())))) 1) (a 2 (c (q . "hello") ())))) 1) (c (q 2 (i ("debug_print" (q . "print.rue:35:5") (q . "Asserting value is a pair")) (q) (q 2 (i (l 1) (q 2 (i ("debug_print" (q . "print.rue:37:5") (q . "Asserting first is a string")) (q) (q 2 (i (not (l (f 1))) (q 2 (i ("debug_print" (q . "print.rue:39:5") (q . "Asserting rest is nil")) (q) (q 2 (i ("debug_print" (q . "print.rue:40:5") 1) (q) (q 2 (i (a (i (not (l (r 1))) (q 2 (i (= (r 1) ()) (q 1 . 1) (q)) 1) (q)) 1) (q 2 (i ("debug_print" (q . "print.rue:42:5") (q . "Value is valid")) (q) (q)) 1) (q 8 (q . "assertion failed at 41:5"))) 1)) 1)) 1) (q 8 (q . "assertion failed at 38:5"))) 1)) 1) (q 8 (q . "assertion failed at 36:5"))) 1)) 1) ())) byte_cost: 2412000 clvm_error: clvm raise () debug_clvm_error: clvm raise "assertion failed at 41:5" diff --git a/tests/guards/impossible_checks.yaml b/tests/guards/impossible_checks.yaml index 8bea4496..bcb49ac1 100644 --- a/tests/guards/impossible_checks.yaml +++ b/tests/guards/impossible_checks.yaml @@ -1,4 +1,4 @@ diagnostics: -- Cannot check if value is of function type at runtime at test:2:5 -- Recursion depth exceeded while checking type at test:6:5 -- Recursion depth exceeded while checking type at test:10:5 +- Cannot check if value is of function type at runtime at impossible_checks.rue:2:5 +- Recursion depth exceeded while checking type at impossible_checks.rue:6:5 +- Recursion depth exceeded while checking type at impossible_checks.rue:10:5 diff --git a/tests/imports/duplicate_imports.yaml b/tests/imports/duplicate_imports.yaml index 69232cb0..9e91f18d 100644 --- a/tests/imports/duplicate_imports.yaml +++ b/tests/imports/duplicate_imports.yaml @@ -5,5 +5,5 @@ runtime_cost: 20 byte_cost: 36000 total_cost: 36020 diagnostics: -- Unused import `thing` at test:6:12 -- Unused import `thing` at test:7:12 +- Unused import `thing` at duplicate_imports.rue:6:12 +- Unused import `thing` at duplicate_imports.rue:7:12 diff --git a/tests/imports/unresolved_imports.yaml b/tests/imports/unresolved_imports.yaml index 746c8883..ba33c32e 100644 --- a/tests/imports/unresolved_imports.yaml +++ b/tests/imports/unresolved_imports.yaml @@ -1,4 +1,4 @@ diagnostics: -- Undeclared symbol `inner` at test:4:16 -- Undeclared symbol `inner` at test:5:16 -- Unresolved import `missing` at test:3:16 +- Undeclared symbol `inner` at unresolved_imports.rue:4:16 +- Undeclared symbol `inner` at unresolved_imports.rue:5:16 +- Unresolved import `missing` at unresolved_imports.rue:3:16 diff --git a/tests/operators.yaml b/tests/operators.yaml index 6f052741..26477f09 100644 --- a/tests/operators.yaml +++ b/tests/operators.yaml @@ -21,6 +21,6 @@ tests: byte_cost: 2628000 total_cost: 2633714 diagnostics: -- Unnecessary `+` operator, since it has no effect at test:2:12 -- Condition always evaluates to `true` at test:51:12 -- Condition always evaluates to `true` at test:52:12 +- Unnecessary `+` operator, since it has no effect at operators.rue:2:12 +- Condition always evaluates to `true` at operators.rue:51:12 +- Condition always evaluates to `true` at operators.rue:52:12 diff --git a/tests/projects/multi_file.yaml b/tests/projects/multi_file.yaml new file mode 100644 index 00000000..ab00ec1f --- /dev/null +++ b/tests/projects/multi_file.yaml @@ -0,0 +1,15 @@ +tests: +- name: greet_world + program: (q . "Hello, world!") + debug_program: (a (q 2 2 (q . "world")) (c (q 14 (concat (q . "Hello, ") 1) (q . 33)) ())) + output: '"Hello, world!"' + runtime_cost: 20 + byte_cost: 192000 + total_cost: 192020 +- name: greet_alice + program: (q . "Hello, Alice!") + debug_program: (a (q 2 2 (q . "Alice")) (c (q 14 (concat (q . "Hello, ") 1) (q . 33)) ())) + output: '"Hello, Alice!"' + runtime_cost: 20 + byte_cost: 192000 + total_cost: 192020 diff --git a/tests/projects/multi_file/main.rue b/tests/projects/multi_file/main.rue new file mode 100644 index 00000000..ee2f67f2 --- /dev/null +++ b/tests/projects/multi_file/main.rue @@ -0,0 +1,9 @@ +import utils::greet; + +test fn greet_world() -> String { + greet("world") +} + +test fn greet_alice() -> String { + greet("Alice") +} diff --git a/tests/projects/multi_file/utils.rue b/tests/projects/multi_file/utils.rue new file mode 100644 index 00000000..a8680619 --- /dev/null +++ b/tests/projects/multi_file/utils.rue @@ -0,0 +1,3 @@ +export fn greet(name: String) -> String { + "Hello, " + name + "!" +} diff --git a/tests/projects/single_file.yaml b/tests/projects/single_file.yaml new file mode 100644 index 00000000..12d9ead6 --- /dev/null +++ b/tests/projects/single_file.yaml @@ -0,0 +1,6 @@ +program: (q . "Hello, world!") +debug_program: (q . "Hello, world!") +output: '"Hello, world!"' +runtime_cost: 20 +byte_cost: 192000 +total_cost: 192020 diff --git a/tests/projects/single_file/main.rue b/tests/projects/single_file/main.rue new file mode 100644 index 00000000..65f92b1f --- /dev/null +++ b/tests/projects/single_file/main.rue @@ -0,0 +1,3 @@ +fn main() -> String { + "Hello, world!" +} diff --git a/tests/projects/subdirectory.yaml b/tests/projects/subdirectory.yaml new file mode 100644 index 00000000..b191010a --- /dev/null +++ b/tests/projects/subdirectory.yaml @@ -0,0 +1,6 @@ +program: (q . "inner outer") +debug_program: (a (q 2 4 (c 6 ())) (c (c (q 14 (q . "inner ") (a 2 ())) (q 1 . "outer")) ())) +output: '"inner outer"' +runtime_cost: 20 +byte_cost: 168000 +total_cost: 168020 diff --git a/tests/projects/subdirectory/a/b/c/inner.rue b/tests/projects/subdirectory/a/b/c/inner.rue new file mode 100644 index 00000000..200de6ea --- /dev/null +++ b/tests/projects/subdirectory/a/b/c/inner.rue @@ -0,0 +1,3 @@ +export fn inner() -> String { + "inner " + super::super::super::main::outer() +} diff --git a/tests/projects/subdirectory/main.rue b/tests/projects/subdirectory/main.rue new file mode 100644 index 00000000..bdfed422 --- /dev/null +++ b/tests/projects/subdirectory/main.rue @@ -0,0 +1,7 @@ +fn main() -> String { + a::b::c::inner::inner() +} + +export fn outer() -> String { + "outer" +} diff --git a/tests/symbols/expr_statements.yaml b/tests/symbols/expr_statements.yaml index 415d23a4..98d0fe1b 100644 --- a/tests/symbols/expr_statements.yaml +++ b/tests/symbols/expr_statements.yaml @@ -64,9 +64,9 @@ tests: byte_cost: 852000 total_cost: 854884 diagnostics: -- Value returned by statement is unused at test:22:5 -- Value returned by statement is unused at test:27:5 -- Value returned by statement is unused at test:31:5 -- Value returned by statement is unused at test:32:5 -- Value returned by statement is unused at test:36:5 -- Value returned by statement is unused at test:37:5 +- Value returned by statement is unused at expr_statements.rue:22:5 +- Value returned by statement is unused at expr_statements.rue:27:5 +- Value returned by statement is unused at expr_statements.rue:31:5 +- Value returned by statement is unused at expr_statements.rue:32:5 +- Value returned by statement is unused at expr_statements.rue:36:5 +- Value returned by statement is unused at expr_statements.rue:37:5 diff --git a/tests/symbols/function_arguments.yaml b/tests/symbols/function_arguments.yaml index 3e64e183..270539e6 100644 --- a/tests/symbols/function_arguments.yaml +++ b/tests/symbols/function_arguments.yaml @@ -1,14 +1,14 @@ diagnostics: -- Expected 2 arguments, but found 0 at test:6:5 -- Expected 2 arguments, but found 1 at test:7:5 -- Expected 2 arguments, but found 3 at test:8:5 -- Spread operator must be used on functions with spread parameters at test:12:5 -- Expected 2 arguments, but found 1 at test:20:5 -- Expected 2 arguments, but found 3 at test:21:5 -- Spread operator must be used on functions with spread parameters at test:25:5 -- Expected 2 arguments, but found 0 at test:25:5 -- Spread operator must be used on functions with spread parameters at test:26:5 -- Expected 2 arguments, but found 1 at test:26:5 -- Spread operator must be used on functions with spread parameters at test:27:5 -- Spread operator must be used on functions with spread parameters at test:28:5 -- Expected 2 arguments, but found 3 at test:28:5 +- Expected 2 arguments, but found 0 at function_arguments.rue:6:5 +- Expected 2 arguments, but found 1 at function_arguments.rue:7:5 +- Expected 2 arguments, but found 3 at function_arguments.rue:8:5 +- Spread operator must be used on functions with spread parameters at function_arguments.rue:12:5 +- Expected 2 arguments, but found 1 at function_arguments.rue:20:5 +- Expected 2 arguments, but found 3 at function_arguments.rue:21:5 +- Spread operator must be used on functions with spread parameters at function_arguments.rue:25:5 +- Expected 2 arguments, but found 0 at function_arguments.rue:25:5 +- Spread operator must be used on functions with spread parameters at function_arguments.rue:26:5 +- Expected 2 arguments, but found 1 at function_arguments.rue:26:5 +- Spread operator must be used on functions with spread parameters at function_arguments.rue:27:5 +- Spread operator must be used on functions with spread parameters at function_arguments.rue:28:5 +- Expected 2 arguments, but found 3 at function_arguments.rue:28:5 diff --git a/tests/symbols/invalid_recursion.yaml b/tests/symbols/invalid_recursion.yaml index aced3740..b486c56a 100644 --- a/tests/symbols/invalid_recursion.yaml +++ b/tests/symbols/invalid_recursion.yaml @@ -1,6 +1,6 @@ diagnostics: -- Function `factorial` cannot be inline, since it references itself at test:5:11 -- Constant `A` references itself at test:13:7 -- Constant `B` references itself at test:14:7 -- Constant `C` references itself at test:15:7 -- Constant `D` references itself at test:16:14 +- Function `factorial` cannot be inline, since it references itself at invalid_recursion.rue:5:11 +- Constant `A` references itself at invalid_recursion.rue:13:7 +- Constant `B` references itself at invalid_recursion.rue:14:7 +- Constant `C` references itself at invalid_recursion.rue:15:7 +- Constant `D` references itself at invalid_recursion.rue:16:14 diff --git a/tests/symbols/private_reference.yaml b/tests/symbols/private_reference.yaml index c08d684a..3eebf567 100644 --- a/tests/symbols/private_reference.yaml +++ b/tests/symbols/private_reference.yaml @@ -1,4 +1,4 @@ diagnostics: -- Cannot reference private type `Type` in module `private` at test:9:23 -- Cannot reference private symbol `function` in module `private` at test:10:14 -- Block does not return a value at test:9:28 +- Cannot reference private type `Type` in module `private` at private_reference.rue:9:23 +- Cannot reference private symbol `function` in module `private` at private_reference.rue:10:14 +- Block does not return a value at private_reference.rue:9:28 diff --git a/tests/symbols/super_errors.yaml b/tests/symbols/super_errors.yaml index 51362c40..dd676561 100644 --- a/tests/symbols/super_errors.yaml +++ b/tests/symbols/super_errors.yaml @@ -1,10 +1,10 @@ diagnostics: -- Unresolved `super`, there is no parent module at test:2:12 -- Unresolved `super`, there is no parent module at test:5:8 -- Cannot end path in `super` at test:6:8 -- Unresolved `super`, there is no parent module at test:7:8 -- Cannot end path in `super` at test:7:15 -- Unresolved import `x` at test:5:15 -- Unresolved import `super` at test:6:8 -- Unresolved import `super` at test:7:15 -- Unused import `a` at test:2:19 +- Unresolved `super`, there is no parent module at super_errors.rue:2:12 +- Unresolved `super`, there is no parent module at super_errors.rue:5:8 +- Cannot end path in `super` at super_errors.rue:6:8 +- Unresolved `super`, there is no parent module at super_errors.rue:7:8 +- Cannot end path in `super` at super_errors.rue:7:15 +- Unresolved import `x` at super_errors.rue:5:15 +- Unresolved import `super` at super_errors.rue:6:8 +- Unresolved import `super` at super_errors.rue:7:15 +- Unused import `a` at super_errors.rue:2:19 diff --git a/tests/symbols/tree_shaking.yaml b/tests/symbols/tree_shaking.yaml index 44f08a70..e6a489ac 100644 --- a/tests/symbols/tree_shaking.yaml +++ b/tests/symbols/tree_shaking.yaml @@ -13,5 +13,5 @@ tests: byte_cost: 444000 total_cost: 445642 diagnostics: -- Unused binding `a` at test:2:9 -- Unused binding `b` at test:3:9 +- Unused binding `a` at tree_shaking.rue:2:9 +- Unused binding `b` at tree_shaking.rue:3:9 diff --git a/tests/types/literal_errors.yaml b/tests/types/literal_errors.yaml index 82a8258d..5046fded 100644 --- a/tests/types/literal_errors.yaml +++ b/tests/types/literal_errors.yaml @@ -1,6 +1,6 @@ diagnostics: -- Cannot assign `34` to `42`, since they are incompatible at test:1:27 -- Cannot assign `0xcafe` to `0xcafef00d`, since they are incompatible at test:5:38 -- Cannot assign `"Hello!"` to `"Hello, world!"`, since they are incompatible at test:9:43 -- Cannot assign `false` to `true`, since they are incompatible at test:13:30 -- Cannot assign `nil` to `true`, since they are incompatible at test:17:29 +- Cannot assign `34` to `42`, since they are incompatible at literal_errors.rue:1:27 +- Cannot assign `0xcafe` to `0xcafef00d`, since they are incompatible at literal_errors.rue:5:38 +- Cannot assign `"Hello!"` to `"Hello, world!"`, since they are incompatible at literal_errors.rue:9:43 +- Cannot assign `false` to `true`, since they are incompatible at literal_errors.rue:13:30 +- Cannot assign `nil` to `true`, since they are incompatible at literal_errors.rue:17:29 diff --git a/tests/types/struct_error.yaml b/tests/types/struct_error.yaml index 803d7d1c..2638c7a8 100644 --- a/tests/types/struct_error.yaml +++ b/tests/types/struct_error.yaml @@ -1,2 +1,2 @@ diagnostics: -- Cannot assign `"1"` to `Int` without a cast, since they are semantically different at test:8:9 +- Cannot assign `"1"` to `Int` without a cast, since they are semantically different at struct_error.rue:8:9 diff --git a/tests/warnings/always_condition.yaml b/tests/warnings/always_condition.yaml index 60fbefa3..4b9ea672 100644 --- a/tests/warnings/always_condition.yaml +++ b/tests/warnings/always_condition.yaml @@ -5,6 +5,6 @@ runtime_cost: 20 byte_cost: 36000 total_cost: 36020 diagnostics: -- Condition always evaluates to `true` at test:2:12 -- Condition always evaluates to `true` at test:3:12 -- Condition always evaluates to `false` at test:5:8 +- Condition always evaluates to `true` at always_condition.rue:2:12 +- Condition always evaluates to `true` at always_condition.rue:3:12 +- Condition always evaluates to `false` at always_condition.rue:5:8 diff --git a/tests/warnings/empty_generic_parameters.yaml b/tests/warnings/empty_generic_parameters.yaml index 1e605ff5..3a2925bf 100644 --- a/tests/warnings/empty_generic_parameters.yaml +++ b/tests/warnings/empty_generic_parameters.yaml @@ -5,8 +5,8 @@ runtime_cost: 44 byte_cost: 12000 total_cost: 12044 diagnostics: -- Unnecessary empty generic parameter list specified at test:6:14 -- Unnecessary empty generic parameter list specified at test:8:11 -- Unnecessary empty generic argument list specified at test:1:19 -- Unnecessary empty generic parameter list specified at test:10:12 -- Unnecessary empty generic argument list specified at test:8:22 +- Unnecessary empty generic parameter list specified at empty_generic_parameters.rue:6:14 +- Unnecessary empty generic parameter list specified at empty_generic_parameters.rue:8:11 +- Unnecessary empty generic argument list specified at empty_generic_parameters.rue:1:19 +- Unnecessary empty generic parameter list specified at empty_generic_parameters.rue:10:12 +- Unnecessary empty generic argument list specified at empty_generic_parameters.rue:8:22 diff --git a/tests/warnings/unnecessary_cast.yaml b/tests/warnings/unnecessary_cast.yaml index c120e172..1bfff766 100644 --- a/tests/warnings/unnecessary_cast.yaml +++ b/tests/warnings/unnecessary_cast.yaml @@ -49,7 +49,7 @@ tests: byte_cost: 156000 total_cost: 156146 diagnostics: -- Unnecessary cast from `42` to `42`, since they are compatible with each other at test:2:5 -- Unnecessary cast from `A` to `A`, since they are compatible with each other at test:14:5 -- Unnecessary cast from `A` to `Alias`, since they are compatible with each other at test:22:5 -- Unnecessary cast from `Alias` to `A`, since they are compatible with each other at test:26:5 +- Unnecessary cast from `42` to `42`, since they are compatible with each other at unnecessary_cast.rue:2:5 +- Unnecessary cast from `A` to `A`, since they are compatible with each other at unnecessary_cast.rue:14:5 +- Unnecessary cast from `A` to `Alias`, since they are compatible with each other at unnecessary_cast.rue:22:5 +- Unnecessary cast from `Alias` to `A`, since they are compatible with each other at unnecessary_cast.rue:26:5 diff --git a/tests/warnings/unnecessary_guard.yaml b/tests/warnings/unnecessary_guard.yaml index e49c44d3..beea91d0 100644 --- a/tests/warnings/unnecessary_guard.yaml +++ b/tests/warnings/unnecessary_guard.yaml @@ -49,11 +49,11 @@ tests: byte_cost: 36000 total_cost: 36020 diagnostics: -- Unnecessary type guard from `Int` to `Int`, since they are already compatible types at test:2:5 -- Unnecessary type guard from `42` to `Int`, since they are already compatible types at test:6:5 -- Unnecessary type guard from `A` to `A`, since they are already compatible types at test:14:5 -- Unnecessary cast from `A` to `Alias`, since they are compatible with each other at test:22:5 -- Unnecessary type guard from `Alias` to `A`, since they are already compatible types at test:22:5 -- Unnecessary cast from `Alias` to `A`, since they are compatible with each other at test:26:5 -- Unnecessary type guard from `A` to `A`, since they are already compatible types at test:26:5 -- Unused struct `B` at test:33:8 +- Unnecessary type guard from `Int` to `Int`, since they are already compatible types at unnecessary_guard.rue:2:5 +- Unnecessary type guard from `42` to `Int`, since they are already compatible types at unnecessary_guard.rue:6:5 +- Unnecessary type guard from `A` to `A`, since they are already compatible types at unnecessary_guard.rue:14:5 +- Unnecessary cast from `A` to `Alias`, since they are compatible with each other at unnecessary_guard.rue:22:5 +- Unnecessary type guard from `Alias` to `A`, since they are already compatible types at unnecessary_guard.rue:22:5 +- Unnecessary cast from `Alias` to `A`, since they are compatible with each other at unnecessary_guard.rue:26:5 +- Unnecessary type guard from `A` to `A`, since they are already compatible types at unnecessary_guard.rue:26:5 +- Unused struct `B` at unnecessary_guard.rue:33:8 diff --git a/tests/warnings/unnecessary_plus.yaml b/tests/warnings/unnecessary_plus.yaml index 2456ef89..c7108da8 100644 --- a/tests/warnings/unnecessary_plus.yaml +++ b/tests/warnings/unnecessary_plus.yaml @@ -5,4 +5,4 @@ runtime_cost: 20 byte_cost: 36000 total_cost: 36020 diagnostics: -- Unnecessary `+` operator, since it has no effect at test:2:5 +- Unnecessary `+` operator, since it has no effect at unnecessary_plus.rue:2:5 diff --git a/tests/warnings/unused_children.yaml b/tests/warnings/unused_children.yaml index 72b3c461..6f87c4f2 100644 --- a/tests/warnings/unused_children.yaml +++ b/tests/warnings/unused_children.yaml @@ -1,10 +1,10 @@ diagnostics: -- Unused function `unused_parameter` at test:1:4 -- Unused parameter `value` at test:1:21 -- Unused function `used_parameter` at test:3:4 -- Unused function `unused_generic` at test:7:4 -- Unused function `used_generic` at test:9:4 -- Unused function `unused_binding` at test:13:4 -- Unused function `used_binding` at test:17:4 -- Unused binding `x` at test:14:9 -- Unused generic type `T` at test:7:19 +- Unused function `unused_parameter` at unused_children.rue:1:4 +- Unused parameter `value` at unused_children.rue:1:21 +- Unused function `used_parameter` at unused_children.rue:3:4 +- Unused function `unused_generic` at unused_children.rue:7:4 +- Unused function `used_generic` at unused_children.rue:9:4 +- Unused function `unused_binding` at unused_children.rue:13:4 +- Unused function `used_binding` at unused_children.rue:17:4 +- Unused binding `x` at unused_children.rue:14:9 +- Unused generic type `T` at unused_children.rue:7:19 diff --git a/tests/warnings/unused_imports.yaml b/tests/warnings/unused_imports.yaml index 886502c1..ce9c1be7 100644 --- a/tests/warnings/unused_imports.yaml +++ b/tests/warnings/unused_imports.yaml @@ -5,16 +5,16 @@ runtime_cost: 20 byte_cost: 36000 total_cost: 36020 diagnostics: -- Unused import `d` at test:38:18 -- Unused import `*` at test:36:18 -- Unused import `*` at test:39:17 -- Unused import `*` at test:40:15 -- Unused import `a` at test:33:16 -- Unused import `*` at test:34:14 -- Unused import `c` at test:35:18 -- Unused import `*` at test:37:18 -- Unused function `a` at test:2:15 -- Unused function `b` at test:8:15 -- Unused function `c` at test:14:15 -- Unused function `d` at test:20:15 -- Unused function `private` at test:26:8 +- Unused import `d` at unused_imports.rue:38:18 +- Unused import `*` at unused_imports.rue:36:18 +- Unused import `*` at unused_imports.rue:39:17 +- Unused import `*` at unused_imports.rue:40:15 +- Unused import `a` at unused_imports.rue:33:16 +- Unused import `*` at unused_imports.rue:34:14 +- Unused import `c` at unused_imports.rue:35:18 +- Unused import `*` at unused_imports.rue:37:18 +- Unused function `a` at unused_imports.rue:2:15 +- Unused function `b` at unused_imports.rue:8:15 +- Unused function `c` at unused_imports.rue:14:15 +- Unused function `d` at unused_imports.rue:20:15 +- Unused function `private` at unused_imports.rue:26:8 diff --git a/tests/warnings/unused_parameters.yaml b/tests/warnings/unused_parameters.yaml index fa96b3fd..722fc088 100644 --- a/tests/warnings/unused_parameters.yaml +++ b/tests/warnings/unused_parameters.yaml @@ -43,7 +43,7 @@ tests: byte_cost: 12000 total_cost: 12048 diagnostics: -- Unused parameter `value` at test:1:31 -- Unused parameter `value` at test:21:21 -- Unused generic type `T` at test:3:29 -- Unused generic type `T` at test:27:19 +- Unused parameter `value` at unused_parameters.rue:1:31 +- Unused parameter `value` at unused_parameters.rue:21:21 +- Unused generic type `T` at unused_parameters.rue:3:29 +- Unused generic type `T` at unused_parameters.rue:27:19 diff --git a/tests/warnings/unused_statement_value.yaml b/tests/warnings/unused_statement_value.yaml index 2553df55..f40de4a1 100644 --- a/tests/warnings/unused_statement_value.yaml +++ b/tests/warnings/unused_statement_value.yaml @@ -28,5 +28,5 @@ tests: byte_cost: 60000 total_cost: 60545 diagnostics: -- Value returned by statement is unused at test:2:5 -- Value returned by statement is unused at test:14:5 +- Value returned by statement is unused at unused_statement_value.rue:2:5 +- Value returned by statement is unused at unused_statement_value.rue:14:5 diff --git a/tests/warnings/unused_symbols.yaml b/tests/warnings/unused_symbols.yaml index 7885de13..7718fa4f 100644 --- a/tests/warnings/unused_symbols.yaml +++ b/tests/warnings/unused_symbols.yaml @@ -13,8 +13,8 @@ tests: byte_cost: 132000 total_cost: 132142 diagnostics: -- Unused constant `UNUSED_IN_MODULE` at test:3:18 -- Unused constant `UNUSED` at test:29:7 -- Unused function `unused` at test:37:4 -- Unused binding `unused` at test:12:9 -- Unused binding `unused` at test:20:9 +- Unused constant `UNUSED_IN_MODULE` at unused_symbols.rue:3:18 +- Unused constant `UNUSED` at unused_symbols.rue:29:7 +- Unused function `unused` at unused_symbols.rue:37:4 +- Unused binding `unused` at unused_symbols.rue:12:9 +- Unused binding `unused` at unused_symbols.rue:20:9 diff --git a/tests/warnings/unused_types.yaml b/tests/warnings/unused_types.yaml index e780e03e..bdb39e76 100644 --- a/tests/warnings/unused_types.yaml +++ b/tests/warnings/unused_types.yaml @@ -27,8 +27,8 @@ tests: byte_cost: 12000 total_cost: 12044 diagnostics: -- Unused constant `UNUSED_VALUE` at test:10:7 -- Unused type alias `Recursive` at test:1:6 -- Unused type alias `Unused` at test:7:6 -- Unused struct `UnusedStruct` at test:16:8 -- Unused type alias `UnusedAlias` at test:21:6 +- Unused constant `UNUSED_VALUE` at unused_types.rue:10:7 +- Unused type alias `Recursive` at unused_types.rue:1:6 +- Unused type alias `Unused` at unused_types.rue:7:6 +- Unused struct `UnusedStruct` at unused_types.rue:16:8 +- Unused type alias `UnusedAlias` at unused_types.rue:21:6