Skip to content

Commit

Permalink
Fix typo in compile error around GM opcodes in external contexts. (Fu…
Browse files Browse the repository at this point in the history
…elLabs#3547)

There's no such thing as an external _contract_, only an external
_context_.
  • Loading branch information
sezna authored Dec 8, 2022
1 parent 2a147d1 commit 8dc9afa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sway-core/src/asm_generation/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn check_script_opcodes(ops: &[AllocatedOp]) -> CompileResult<()> {
for op in ops {
match op.opcode {
GM(_, VirtualImmediate18 { value: 1..=2 }) => {
errors.push(CompileError::GMFromExternalContract {
errors.push(CompileError::GMFromExternalContext {
span: get_op_span(op),
});
}
Expand Down Expand Up @@ -113,7 +113,7 @@ fn check_predicate_opcodes(ops: &[AllocatedOp]) -> CompileResult<()> {
CROO(..) => invalid_opcode("CROO", &mut errors),
CSIZ(..) => invalid_opcode("CSIZ", &mut errors),
GM(_, VirtualImmediate18 { value: 1..=2 }) => {
errors.push(CompileError::GMFromExternalContract {
errors.push(CompileError::GMFromExternalContext {
span: get_op_span(op),
});
}
Expand Down
4 changes: 2 additions & 2 deletions sway-error/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ pub enum CompileError {
#[error("File {file_path} generates an infinite dependency cycle.")]
InfiniteDependencies { file_path: String, span: Span },
#[error("The GM (get-metadata) opcode, when called from an external context, will cause the VM to panic.")]
GMFromExternalContract { span: Span },
GMFromExternalContext { span: Span },
#[error("The MINT opcode cannot be used in an external context.")]
MintFromExternalContext { span: Span },
#[error("The BURN opcode cannot be used in an external context.")]
Expand Down Expand Up @@ -812,7 +812,7 @@ impl Spanned for CompileError {
RecursiveTypeChain { span, .. } => span.clone(),
TypeWithUnknownSize { span, .. } => span.clone(),
InfiniteDependencies { span, .. } => span.clone(),
GMFromExternalContract { span, .. } => span.clone(),
GMFromExternalContext { span, .. } => span.clone(),
MintFromExternalContext { span, .. } => span.clone(),
BurnFromExternalContext { span, .. } => span.clone(),
ContractStorageFromExternalContext { span, .. } => span.clone(),
Expand Down

0 comments on commit 8dc9afa

Please sign in to comment.