Add explicit managed traits and inherited method arity contracts
This commit is contained in:
@@ -13,6 +13,11 @@ pub enum VmError {
|
||||
UnsupportedOperation(&'static str),
|
||||
InvalidArgument(&'static str),
|
||||
ObjectKindMismatch(&'static str),
|
||||
TraitViolation {
|
||||
capability: String,
|
||||
method: String,
|
||||
reason: &'static str,
|
||||
},
|
||||
EmptyCell,
|
||||
InvalidBytecode {
|
||||
offset: usize,
|
||||
@@ -43,6 +48,11 @@ impl fmt::Display for VmError {
|
||||
}
|
||||
Self::InvalidArgument(message) => f.write_str(message),
|
||||
Self::ObjectKindMismatch(expected) => write!(f, "expected {expected} object"),
|
||||
Self::TraitViolation {
|
||||
capability,
|
||||
method,
|
||||
reason,
|
||||
} => write!(f, "trait {capability} method {method}: {reason}"),
|
||||
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