Check source function annotations and unify managed function identity

This commit is contained in:
2026-10-21 22:38:22 +08:00
parent eb60212428
commit 6346041f77
27 changed files with 568 additions and 40 deletions
+19
View File
@@ -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}")