diff --git a/crates/typst/src/foundations/ty.rs b/crates/typst/src/foundations/ty.rs index b34393b3e..3bcde61f6 100644 --- a/crates/typst/src/foundations/ty.rs +++ b/crates/typst/src/foundations/ty.rs @@ -5,7 +5,9 @@ use ecow::{eco_format, EcoString}; use once_cell::sync::Lazy; use crate::diag::StrResult; -use crate::foundations::{cast, func, Func, NativeFuncData, Repr, Scope, Value}; +use crate::foundations::{ + cast, func, AutoValue, Func, NativeFuncData, NoneValue, Repr, Scope, Value, +}; use crate::utils::Static; #[rustfmt::skip] @@ -148,7 +150,14 @@ impl Debug for Type { impl Repr for Type { fn repr(&self) -> EcoString { - self.long_name().into() + if *self == Type::of::() { + "type(auto)" + } else if *self == Type::of::() { + "type(none)" + } else { + self.long_name() + } + .into() } } diff --git a/crates/typst/src/foundations/value.rs b/crates/typst/src/foundations/value.rs index 05abbfba1..787699001 100644 --- a/crates/typst/src/foundations/value.rs +++ b/crates/typst/src/foundations/value.rs @@ -727,6 +727,9 @@ mod tests { fn test_value_debug() { // Primitives. test(Value::None, "none"); + test(Value::Auto, "auto"); + test(Value::None.ty(), "type(none)"); + test(Value::Auto.ty(), "type(auto)"); test(false, "false"); test(12i64, "12"); test(3.24, "3.24"); diff --git a/tests/suite/foundations/type.typ b/tests/suite/foundations/type.typ index f2a988450..6ab4be4f0 100644 --- a/tests/suite/foundations/type.typ +++ b/tests/suite/foundations/type.typ @@ -23,3 +23,9 @@ --- issue-3110-associated-function --- // Error: 6-18 type string does not contain field `from-unĂ¯code` #str.from-unĂ¯code(97) + +--- issue-2747-repr-auto-none --- +#test(repr(none), "none") +#test(repr(auto), "auto") +#test(repr(type(none)), "type(none)") +#test(repr(type(auto)), "type(auto)")