Skip to content

Commit

Permalink
Fix broken RustGlue.roc interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
smores56 committed Jan 10, 2025
1 parent eb1b5ff commit b0a5b1c
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"{(g)" : q
"${g}" : q
f
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""{(g)""":q
"""${g}""":q
f
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""""""${i""""""}"
"""""""${i""""""}"
6 changes: 3 additions & 3 deletions crates/glue/src/RustGlue.roc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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}) }
}
"""
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion www/content/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b0a5b1c

Please sign in to comment.