Skip to content

Commit

Permalink
Merge 4284e8e into 5d796fb
Browse files Browse the repository at this point in the history
  • Loading branch information
esdrubal authored Aug 7, 2024
2 parents 5d796fb + 4284e8e commit 7bd877b
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,14 @@ fn type_check_encode_append(
_type_arguments: &[TypeArgument],
span: Span,
) -> Result<(ty::TyIntrinsicFunctionKind, TypeId), ErrorEmitted> {
if arguments.len() != 2 {
return Err(handler.emit_err(CompileError::IntrinsicIncorrectNumArgs {
name: kind.to_string(),
expected: 2,
span,
}));
}

let type_engine = ctx.engines.te();
let engines = ctx.engines();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[package]]
name = "encode_append_wrong_args"
source = "member"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[project]
authors = ["Fuel Labs <contact@fuel.sh>"]
entry = "main.sw"
license = "Apache-2.0"
name = "encode_append_wrong_args"
implicit-std = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
library;

pub struct Buffer {
buffer: u64
}

pub trait T {
fn ar(buffer: Buffer) -> Buffer;
}

impl T for str[10] {
fn ar(buffer: Buffer) -> Buffer {
Buffer {
buffer: __encode_buffer_append(buffer.buffer)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
category = "fail"

# check: $()warning
# check: $()buffer: __encode_buffer_append(buffer.buffer)

# check: $()buffer: __encode_buffer_append(buffer.buffer)
# nextln: $()Call to "encode_buffer_append" expects 2 arguments

0 comments on commit 7bd877b

Please sign in to comment.