From b0a5b1c3d57c9e89b761f8a65c9f5bff7b5a8307 Mon Sep 17 00:00:00 2001 From: Sam Mohr Date: Fri, 10 Jan 2025 10:55:40 -0800 Subject: [PATCH] Fix broken RustGlue.roc interpolation --- .../snapshots/pass/block_string_ann.expr.formatted.roc | 2 +- .../tests/snapshots/pass/block_string_ann.expr.roc | 2 +- .../tests/snapshots/pass/multiline_str_crazyness.expr.roc | 2 +- crates/glue/src/RustGlue.roc | 6 +++--- www/content/tutorial.md | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.formatted.roc index 80a7b24b8e..89aa5ea89b 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.formatted.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.formatted.roc @@ -1,2 +1,2 @@ -"{(g)" : q +"${g}" : q f \ No newline at end of file diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.roc b/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.roc index dbe3f487a5..809a11a8a8 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/block_string_ann.expr.roc @@ -1,2 +1,2 @@ -"""{(g)""":q +"""${g}""":q f diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/multiline_str_crazyness.expr.roc b/crates/compiler/test_syntax/tests/snapshots/pass/multiline_str_crazyness.expr.roc index c479285481..3f48e3217e 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/multiline_str_crazyness.expr.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/multiline_str_crazyness.expr.roc @@ -1 +1 @@ -"""""""${i""""""}" +"""""""${i""""""}" \ No newline at end of file diff --git a/crates/glue/src/RustGlue.roc b/crates/glue/src/RustGlue.roc index fa717deb61..a3761dcfcf 100644 --- a/crates/glue/src/RustGlue.roc +++ b/crates/glue/src/RustGlue.roc @@ -858,7 +858,7 @@ generate_non_nullable_unwrapped = \buf, types, name, tag_name, payload, discrimi pub struct ${escaped_name}(roc_std::RocBox<${name}_${tag_name}>); impl ${escaped_name} { - pub fn ${tag_name)(${constructor_arguments}) -> Self { + pub fn ${tag_name}(${constructor_arguments}) -> Self { let payload = ${name}_${tag_name} { ${payload_field_names} }; Self(roc_std::RocBox::new(payload)) @@ -997,7 +997,7 @@ generate_recursive_tag_union = \buf, types, id, tag_union_name, tags, discrimina pub fn get_${tag_name}(mut self) -> ${escaped_name}_${tag_name} { debug_assert!(self.is_${tag_name}()); - unsafe { core::mem::ManuallyDrop::take(&mut self.ptr_read_union().{dtag_name}) } + unsafe { core::mem::ManuallyDrop::take(&mut self.ptr_read_union().${tag_name}) } } """ @@ -2218,7 +2218,7 @@ type_name = \types, id -> RocList(elem) -> elem_name = type_name(types, elem) - "roc_std::RocList<{delem_name}>" + "roc_std::RocList<${elem_name}>" RocBox(elem) -> elem_name = type_name(types, elem) diff --git a/www/content/tutorial.md b/www/content/tutorial.md index b05f5bcab7..344616cd1d 100644 --- a/www/content/tutorial.md +++ b/www/content/tutorial.md @@ -1017,7 +1017,7 @@ Sometimes you may want to document the type of a definition. For example, you mi ```roc # Takes a first_name string and a last_name string, and returns a string full_name = \first_name, last_name -> - "${first_name) ${last_name}" + "${first_name} ${last_name}" ``` Comments can be valuable documentation, but they can also get out of date and become misleading. If someone changes this function and forgets to update the comment, it will no longer be accurate.