git.delta.rocks / jrsonnet / refs/commits / 186ae516608e

difftreelog

fix type errors are acyclic

slzzmqtoYaroslav Bolyukin2026-03-23parent: #976458d.patch.diff
in: master

1 file changed

modifiedcrates/jrsonnet-evaluator/src/typed/mod.rsdiffbeforeafterboth
22
3pub(crate) mod conversions;3pub(crate) mod conversions;
4pub use conversions::*;4pub use conversions::*;
5use jrsonnet_gcmodule::Trace;5use jrsonnet_gcmodule::Acyclic;
6pub use jrsonnet_types::{ComplexValType, ValType};6pub use jrsonnet_types::{ComplexValType, ValType};
7use thiserror::Error;7use thiserror::Error;
88
11 in_description_frame, Val,11 in_description_frame, Val,
12};12};
1313
14#[derive(Debug, Error, Clone, Trace)]14#[derive(Debug, Error, Clone, Acyclic)]
15pub enum TypeError {15pub enum TypeError {
16 #[error("expected {0}, got {1}")]16 #[error("expected {0}, got {1}")]
17 ExpectedGot(ComplexValType, ValType),17 ExpectedGot(ComplexValType, ValType),
18 #[error("missing property {0} from {1}")]18 #[error("missing property {0} from {1}")]
19 MissingProperty(#[trace(skip)] Rc<str>, ComplexValType),19 MissingProperty(Rc<str>, ComplexValType),
20 #[error("every failed from {0}:\n{1}")]20 #[error("every failed from {0}:\n{1}")]
21 UnionFailed(ComplexValType, TypeLocErrorList),21 UnionFailed(ComplexValType, TypeLocErrorList),
22 #[error(22 #[error(
32 }32 }
33}33}
3434
35#[derive(Debug, Clone, Trace)]35#[derive(Debug, Clone, Acyclic)]
36pub struct TypeLocError(Box<TypeError>, ValuePathStack);36pub struct TypeLocError(Box<TypeError>, ValuePathStack);
37impl From<TypeError> for TypeLocError {37impl From<TypeError> for TypeLocError {
38 fn from(e: TypeError) -> Self {38 fn from(e: TypeError) -> Self {
54 }54 }
55}55}
5656
57#[derive(Debug, Clone, Trace)]57#[derive(Debug, Clone, Acyclic)]
58pub struct TypeLocErrorList(Vec<TypeLocError>);58pub struct TypeLocErrorList(Vec<TypeLocError>);
59impl Display for TypeLocErrorList {59impl Display for TypeLocErrorList {
60 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {60 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
116 }116 }
117}117}
118118
119#[derive(Clone, Debug, Trace)]119#[derive(Clone, Debug, Acyclic)]
120enum ValuePathItem {120enum ValuePathItem {
121 Field(#[trace(skip)] Rc<str>),121 Field(Rc<str>),
122 Index(u64),122 Index(u64),
123}123}
124impl Display for ValuePathItem {124impl Display for ValuePathItem {
131 }131 }
132}132}
133133
134#[derive(Clone, Debug, Trace)]134#[derive(Clone, Debug, Acyclic)]
135struct ValuePathStack(Vec<ValuePathItem>);135struct ValuePathStack(Vec<ValuePathItem>);
136impl Display for ValuePathStack {136impl Display for ValuePathStack {
137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {137 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {