summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLeedehai <18319900+Leedehai@users.noreply.github.com>2024-01-09 02:45:24 -0500
committerGitHub <noreply@github.com>2024-01-09 07:45:24 +0000
commit23875a04832a79b6c4fa47d243d9af9650839ff6 (patch)
treedcb08295a1be47f045ad630ba68b3a822393fb19 /crates
parent712eaaa5f404aff51163919d43361d9c2bb19873 (diff)
Let type constructor/field access error report the name correctly (#3140)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/foundations/ty.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/typst/src/foundations/ty.rs b/crates/typst/src/foundations/ty.rs
index 4c2098f3..4b9f19a9 100644
--- a/crates/typst/src/foundations/ty.rs
+++ b/crates/typst/src/foundations/ty.rs
@@ -94,10 +94,10 @@ impl Type {
.constructor
.as_ref()
.map(|lazy| Func::from(*lazy))
- .ok_or_else(|| eco_format!("type self does not have a constructor"))
+ .ok_or_else(|| eco_format!("type {self} does not have a constructor"))
}
- /// The type's associated scope of sub-definition.
+ /// The type's associated scope that holds sub-definitions.
pub fn scope(&self) -> &'static Scope {
&(self.0).0.scope
}
@@ -106,13 +106,13 @@ impl Type {
pub fn field(&self, field: &str) -> StrResult<&'static Value> {
self.scope()
.get(field)
- .ok_or_else(|| eco_format!("type self does not contain field `{}`", field))
+ .ok_or_else(|| eco_format!("type {self} does not contain field `{field}`"))
}
}
// Type compatibility.
impl Type {
- /// The type's backwards-compatible name.
+ /// The type's backward-compatible name.
pub fn compat_name(&self) -> &str {
self.long_name()
}