Check source function annotations and unify managed function identity
This commit is contained in:
@@ -18,6 +18,13 @@ pub enum VmError {
|
||||
method: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
UnknownAnnotation(String),
|
||||
TypeMismatch {
|
||||
function: String,
|
||||
position: String,
|
||||
expected: String,
|
||||
actual: String,
|
||||
},
|
||||
EmptyCell,
|
||||
InvalidBytecode {
|
||||
offset: usize,
|
||||
@@ -53,6 +60,18 @@ impl fmt::Display for VmError {
|
||||
method,
|
||||
reason,
|
||||
} => write!(f, "trait {capability} method {method}: {reason}"),
|
||||
Self::UnknownAnnotation(name) => {
|
||||
write!(f, "unknown or invalid type annotation: {name}")
|
||||
}
|
||||
Self::TypeMismatch {
|
||||
function,
|
||||
position,
|
||||
expected,
|
||||
actual,
|
||||
} => write!(
|
||||
f,
|
||||
"{function} {position} expects {expected}, received {actual}"
|
||||
),
|
||||
Self::EmptyCell => f.write_str("cell is empty"),
|
||||
Self::InvalidBytecode { offset, reason } => {
|
||||
write!(f, "invalid bytecode at code unit {offset}: {reason}")
|
||||
|
||||
Reference in New Issue
Block a user