From 1a5823c59c1117c4ea8209256149931392d4bb27 Mon Sep 17 00:00:00 2001 From: sofia Date: Sat, 16 Aug 2025 16:13:45 +0300 Subject: [PATCH] Add failing loop edge case example --- examples/a1.reid | 10 ---------- examples/a3.reid | 7 ------- examples/associated_functions.reid | 1 + examples/compilcated_main.reid | 10 ++++++++++ examples/{a2.reid => complicated_imported.reid} | 0 examples/loop_edge_case.reid | 9 +++++++++ reid-lsp/src/main.rs | 2 +- reid/tests/e2e.rs | 5 +++++ 8 files changed, 26 insertions(+), 18 deletions(-) delete mode 100644 examples/a1.reid delete mode 100644 examples/a3.reid create mode 100644 examples/compilcated_main.reid rename examples/{a2.reid => complicated_imported.reid} (100%) create mode 100644 examples/loop_edge_case.reid diff --git a/examples/a1.reid b/examples/a1.reid deleted file mode 100644 index ef8203f..0000000 --- a/examples/a1.reid +++ /dev/null @@ -1,10 +0,0 @@ -import a2::Foo; -import a2::A; -import a2::AResult; - -fn main() -> i32 { - let foo = Foo {}; - let a = A::new(); - foo.foo(&a.a); - return 0; -} diff --git a/examples/a3.reid b/examples/a3.reid deleted file mode 100644 index 0485958..0000000 --- a/examples/a3.reid +++ /dev/null @@ -1,7 +0,0 @@ -fn main() -> i32 { - let a = 4f32; - if (a % 2) == 0 { - return 1; - } - return 0; -} \ No newline at end of file diff --git a/examples/associated_functions.reid b/examples/associated_functions.reid index 8c7a087..f1c2552 100644 --- a/examples/associated_functions.reid +++ b/examples/associated_functions.reid @@ -32,6 +32,7 @@ fn main() -> u32 { print(from_str("i32: ") + i32::test(54) as u64); print(from_str("sizeof i32: ") + i32::sizeof()); + let nullptr = i32::null(); let mut list = u64::malloc(15); list[4] = 17; diff --git a/examples/compilcated_main.reid b/examples/compilcated_main.reid new file mode 100644 index 0000000..38b5103 --- /dev/null +++ b/examples/compilcated_main.reid @@ -0,0 +1,10 @@ +import complicated_imported::Foo; +import complicated_imported::A; +import complicated_imported::AResult; + +fn main() -> i32 { + let foo = Foo {}; + let a = A::new(); + foo.foo(&a.a); + return 0; +} \ No newline at end of file diff --git a/examples/a2.reid b/examples/complicated_imported.reid similarity index 100% rename from examples/a2.reid rename to examples/complicated_imported.reid diff --git a/examples/loop_edge_case.reid b/examples/loop_edge_case.reid new file mode 100644 index 0000000..52280ef --- /dev/null +++ b/examples/loop_edge_case.reid @@ -0,0 +1,9 @@ +fn main() -> i32 { + for i in 0..1 { + let j = i; + if i != j { + return 1; + } + } + return 0; +} \ No newline at end of file diff --git a/reid-lsp/src/main.rs b/reid-lsp/src/main.rs index 4060272..039b623 100644 --- a/reid-lsp/src/main.rs +++ b/reid-lsp/src/main.rs @@ -60,7 +60,7 @@ impl LanguageServer for Backend { let capabilities = ServerCapabilities { hover_provider: Some(HoverProviderCapability::Simple(true)), completion_provider: Some(CompletionOptions { - trigger_characters: Some(vec![".".to_string(), "::".to_string()]), + trigger_characters: None, all_commit_characters: None, completion_item: Some(lsp_types::CompletionOptionsCompletionItem { label_details_support: Some(true), diff --git a/reid/tests/e2e.rs b/reid/tests/e2e.rs index 7ba6c9f..3588a59 100644 --- a/reid/tests/e2e.rs +++ b/reid/tests/e2e.rs @@ -169,3 +169,8 @@ fn mutable_inner_functions() { fn cpu_raytracer_compiles() { test_compile(include_str!("../../examples/cpu_raytracer.reid"), "test"); } + +#[test] +fn loop_edge_case_functions() { + test(include_str!("../../examples/loop_edge_case.reid"), "test", Some(0)); +}