pub enum TypeCheckerError {
Formatted(Formatted),
Backtraced(Backtraced),
}
Variants§
Formatted(Formatted)
Backtraced(Backtraced)
Implementations§
Source§impl TypeCheckerError
impl TypeCheckerError
Sourcepub fn invalid_assignment_target(target: impl Display, span: Span) -> Self
pub fn invalid_assignment_target(target: impl Display, span: Span) -> Self
For when the type checker encountered an invalid assignment target.
Sourcepub fn cannot_assign_to_const_input(input: impl Display, span: Span) -> Self
pub fn cannot_assign_to_const_input(input: impl Display, span: Span) -> Self
For when the user tries to assign to a const input.
Sourcepub fn cannot_assign_to_const_var(var: impl Display, span: Span) -> Self
pub fn cannot_assign_to_const_var(var: impl Display, span: Span) -> Self
For when the user tries to assign to a const input.
Sourcepub fn type_should_be(
type_: impl Display,
expected: impl Display,
span: Span,
) -> Self
pub fn type_should_be( type_: impl Display, expected: impl Display, span: Span, ) -> Self
For when the user tries to assign to a const input.
Sourcepub fn could_not_determine_type(expr: impl Display, span: Span) -> Self
pub fn could_not_determine_type(expr: impl Display, span: Span) -> Self
For when the type checker cannot determine the type of an expression.
Sourcepub fn unknown_sym(kind: impl Display, sym: impl Display, span: Span) -> Self
pub fn unknown_sym(kind: impl Display, sym: impl Display, span: Span) -> Self
For when the user tries to return a unknown variable.
Sourcepub fn incorrect_num_args_to_call(
expected: impl Display,
received: impl Display,
span: Span,
) -> Self
pub fn incorrect_num_args_to_call( expected: impl Display, received: impl Display, span: Span, ) -> Self
For when the user tries calls a function with the incorrect number of args.
Sourcepub fn expected_one_type_of(
expected: impl Display,
received: impl Display,
span: Span,
) -> Self
pub fn expected_one_type_of( expected: impl Display, received: impl Display, span: Span, ) -> Self
For when one of the following types was expected.
Sourcepub fn invalid_int_value(
value: impl Display,
type_: impl Display,
span: Span,
) -> Self
pub fn invalid_int_value( value: impl Display, type_: impl Display, span: Span, ) -> Self
For when an integer is not in a valid range. Also repurposing for when a group value is not valid.
Sourcepub fn invalid_core_function(
struct_: impl Display,
function: impl Display,
span: Span,
) -> Self
pub fn invalid_core_function( struct_: impl Display, function: impl Display, span: Span, ) -> Self
For when an invalid core function is used.
Sourcepub fn core_type_name_conflict(type_: impl Display, span: Span) -> Self
pub fn core_type_name_conflict(type_: impl Display, span: Span) -> Self
For when a struct is created with the same name as a core type.
Sourcepub fn function_has_no_return(func: impl Display, span: Span) -> Self
pub fn function_has_no_return(func: impl Display, span: Span) -> Self
For when a function doesn’t have a return statement.
Sourcepub fn incorrect_num_struct_members(
expected: impl Display,
received: impl Display,
span: Span,
) -> Self
pub fn incorrect_num_struct_members( expected: impl Display, received: impl Display, span: Span, ) -> Self
For when the user tries initialize a struct with the incorrect number of args.
Sourcepub fn missing_struct_member(
struct_: impl Display,
member: impl Display,
span: Span,
) -> Self
pub fn missing_struct_member( struct_: impl Display, member: impl Display, span: Span, ) -> Self
For when the user is missing a struct member during initialization.
Sourcepub fn invalid_core_function_call(expr: impl Display, span: Span) -> Self
pub fn invalid_core_function_call(expr: impl Display, span: Span) -> Self
An invalid access call is made e.g., `SHA256::hash()
Sourcepub fn duplicate_struct_member(struct_: impl Display, span: Span) -> Self
pub fn duplicate_struct_member(struct_: impl Display, span: Span) -> Self
Attempted to define more that one struct member with the same name.
Sourcepub fn duplicate_record_variable(record: impl Display, span: Span) -> Self
pub fn duplicate_record_variable(record: impl Display, span: Span) -> Self
Attempted to define more that one record variable with the same name.
Sourcepub fn undefined_type(type_: impl Display, span: Span) -> Self
pub fn undefined_type(type_: impl Display, span: Span) -> Self
Attempted to access an invalid struct.
Sourcepub fn invalid_struct_variable(
variable: impl Display,
struct_: impl Display,
span: Span,
) -> Self
pub fn invalid_struct_variable( variable: impl Display, struct_: impl Display, span: Span, ) -> Self
Attempted to access an invalid struct variable.
pub fn required_record_variable( name: impl Display, type_: impl Display, span: Span, ) -> Self
pub fn record_var_wrong_type( name: impl Display, type_: impl Display, span: Span, ) -> Self
pub fn compare_address(operator: impl Display, span: Span) -> Self
pub fn incorrect_tuple_length( expected: impl Display, actual: impl Display, span: Span, ) -> Self
pub fn invalid_tuple(span: Span) -> Self
pub fn tuple_out_of_range( index: impl Display, length: impl Display, span: Span, ) -> Self
pub fn unreachable_code_after_return(span: Span) -> Self
pub fn loop_body_contains_return(span: Span) -> Self
pub fn unknown_annotation(annotation: impl Display, span: Span) -> Self
pub fn regular_function_inputs_cannot_have_modes(span: Span) -> Self
pub fn async_function_input_cannot_be_private(span: Span) -> Self
pub fn struct_or_record_cannot_contain_record( parent: impl Display, child: impl Display, span: Span, ) -> Self
pub fn invalid_mapping_type( component: impl Display, type_: impl Display, span: Span, ) -> Self
pub fn async_function_input_must_be_public(span: Span) -> Self
pub fn finalize_output_mode_must_be_public(span: Span) -> Self
pub fn invalid_operation_outside_finalize( operation: impl Display, span: Span, ) -> Self
pub fn loop_body_contains_finalize(span: Span) -> Self
pub fn missing_return(span: Span) -> Self
pub fn finalize_block_must_not_be_empty(span: Span) -> Self
pub fn cannot_have_constant_output_mode(span: Span) -> Self
pub fn transition_function_inputs_cannot_be_const(span: Span) -> Self
pub fn invalid_self_access(span: Span) -> Self
pub fn invalid_type(type_: impl Display, span: Span) -> Self
pub fn can_only_call_inline_function(span: Span) -> Self
pub fn cannot_invoke_call_to_local_transition_function(span: Span) -> Self
pub fn loop_bound_must_be_a_literal(span: Span) -> Self
pub fn strings_are_not_supported(span: Span) -> Self
pub fn imported_program_cannot_import_program(span: Span) -> Self
pub fn too_many_transitions(max: impl Display, span: Span) -> Self
pub fn assign_unit_expression_to_variable(span: Span) -> Self
pub fn nested_tuple_type(span: Span) -> Self
pub fn composite_data_type_cannot_contain_tuple( data_type: impl Display, span: Span, ) -> Self
pub fn function_cannot_take_tuple_as_input(span: Span) -> Self
pub fn nested_tuple_expression(span: Span) -> Self
pub fn expression_statement_must_be_function_call(span: Span) -> Self
pub fn lhs_tuple_element_must_be_an_identifier(span: Span) -> Self
pub fn lhs_must_be_identifier_or_tuple(span: Span) -> Self
pub fn unit_expression_only_in_return_statements(span: Span) -> Self
pub fn function_cannot_input_or_output_a_record(span: Span) -> Self
pub fn cyclic_struct_dependency(path: Vec<impl Display>) -> Self
pub fn cyclic_function_dependency(path: Vec<impl Display>) -> Self
pub fn struct_cannot_have_member_mode(span: Span) -> Self
pub fn cannot_call_external_inline_function(span: Span) -> Self
pub fn too_many_mappings(max: impl Display, span: Span) -> Self
Sourcepub fn invalid_associated_constant(expr: impl Display, span: Span) -> Self
pub fn invalid_associated_constant(expr: impl Display, span: Span) -> Self
A call to an invalid associated constant is made e.g., bool::MAX
Sourcepub fn invalid_core_constant(
type_: impl Display,
constant: impl Display,
span: Span,
) -> Self
pub fn invalid_core_constant( type_: impl Display, constant: impl Display, span: Span, ) -> Self
For when an invalid core constant is called.
Sourcepub fn invalid_block_access(span: Span) -> Self
pub fn invalid_block_access(span: Span) -> Self
For when an invalid field of block is called.
pub fn invalid_operation_inside_finalize( operation: impl Display, span: Span, ) -> Self
pub fn operation_must_be_in_finalize_block(span: Span) -> Self
pub fn loop_range_decreasing(span: Span) -> Self
pub fn loop_bound_type_mismatch(span: Span) -> Self
pub fn const_declaration_must_be_literal_or_tuple_of_literals( span: Span, ) -> Self
pub fn loop_bound_must_be_literal_or_const(span: Span) -> Self
pub fn incorrect_num_tuple_elements( identifiers: impl Display, types: impl Display, span: Span, ) -> Self
pub fn const_declaration_can_only_have_one_binding(span: Span) -> Self
pub fn stub_functions_must_not_be_inlines(span: Span) -> Self
pub fn stub_functions_must_be_empty(span: Span) -> Self
pub fn array_empty(span: Span) -> Self
pub fn array_too_large( size: impl Display, max: impl Display, span: Span, ) -> Self
pub fn array_element_cannot_be_tuple(span: Span) -> Self
pub fn array_element_cannot_be_record(span: Span) -> Self
pub fn stubs_cannot_have_non_record_structs(span: Span) -> Self
pub fn stubs_cannot_have_const_declarations(span: Span) -> Self
pub fn stub_name_mismatch( stub_name: impl Display, program_name: impl Display, span: Span, ) -> Self
pub fn no_transitions(span: Span) -> Self
pub fn cannot_define_external_struct(struct_: impl Display, span: Span) -> Self
pub fn struct_definitions_dont_match( struct_: impl Display, program_1: impl Display, program_2: impl Display, span: Span, ) -> Self
pub fn async_transition_invalid_output(span: Span) -> Self
pub fn must_propagate_all_futures( never_propagated: impl Display, span: Span, ) -> Self
pub fn async_transition_must_call_async_function(span: Span) -> Self
pub fn async_function_input_length_mismatch( expected: impl Display, received: impl Display, span: Span, ) -> Self
pub fn invalid_future_access( num: impl Display, len: impl Display, span: Span, ) -> Self
pub fn future_access_must_be_number(name: impl Display, span: Span) -> Self
pub fn no_path_awaits_all_futures_exactly_once( num_total_paths: impl Display, span: Span, ) -> Self
pub fn future_awaits_missing(unawaited: impl Display, span: Span) -> Self
pub fn cannot_reassign_future_variable(var: impl Display, span: Span) -> Self
pub fn invalid_await_call(span: Span) -> Self
pub fn can_only_await_one_future_at_a_time(span: Span) -> Self
pub fn expected_future(type_: impl Display, span: Span) -> Self
pub fn invalid_method_call(span: Span) -> Self
pub fn async_call_in_conditional(span: Span) -> Self
pub fn must_call_async_function_once(span: Span) -> Self
pub fn async_call_can_only_be_done_from_async_transition(span: Span) -> Self
pub fn external_transition_call_must_be_before_finalize(span: Span) -> Self
pub fn unknown_future_consumed(future: impl Display, span: Span) -> Self
pub fn not_all_futures_consumed(unconsumed: impl Display, span: Span) -> Self
pub fn async_transition_missing_future_to_return(span: Span) -> Self
pub fn async_function_cannot_return_value(span: Span) -> Self
pub fn return_type_of_finalize_function_is_future(span: Span) -> Self
pub fn cannot_modify_external_mapping( operation: impl Display, span: Span, ) -> Self
pub fn async_cannot_assign_outside_conditional( variable: impl Display, span: Span, ) -> Self
pub fn only_async_transition_can_return_future(span: Span) -> Self
pub fn async_function_not_found(name: impl Display, span: Span) -> Self
pub fn empty_struct(span: Span) -> Self
pub fn empty_function_arglist(span: Span) -> Self
pub fn composite_data_type_cannot_contain_future( data_type: impl Display, span: Span, ) -> Self
pub fn array_element_cannot_be_future(span: Span) -> Self
pub fn no_future_parameters(span: Span) -> Self
Sourcepub fn type_should_be2(
type_: impl Display,
expected: impl Display,
span: Span,
) -> Self
pub fn type_should_be2( type_: impl Display, expected: impl Display, span: Span, ) -> Self
For when the user tries to assign to a const input.
This is a replacement for type_should_be
with a slightly better message.
pub fn ternary_branch_mismatch( type1: impl Display, type2: impl Display, span: Span, ) -> Self
pub fn operation_types_mismatch( operation: impl Display, type1: impl Display, type2: impl Display, span: Span, ) -> Self
pub fn mul_types_mismatch( type1: impl Display, type2: impl Display, span: Span, ) -> Self
pub fn pow_types_mismatch( type1: impl Display, type2: impl Display, span: Span, ) -> Self
pub fn shift_type_magnitude( operation: impl Display, rhs_type: impl Display, span: Span, ) -> Self
pub fn unit_type_only_return(span: Span) -> Self
pub fn future_error_member(num: impl Display, span: Span) -> Self
pub fn cannot_reassign_mapping(var: impl Display, span: Span) -> Self
pub fn records_not_allowed_inside_finalize(span: Span) -> Self
pub fn script_in_non_test(func: impl Display, span: Span) -> Self
pub fn non_script_calls_script(call: impl Display, span: Span) -> Self
pub fn annotation_error(message: impl Display, span: Span) -> Self
pub fn ternary_over_external_records(ty: impl Display, span: Span) -> Self
pub fn assignment_to_external_record(ty: impl Display, span: Span) -> Self
pub fn illegal_name( item_name: impl Display, item_type: impl Display, keyword: impl Display, span: Span, ) -> Self
pub fn record_prefixed_by_other_record( r1: impl Display, r2: impl Display, span: Span, ) -> Self
pub fn range_bounds_type_mismatch(span: Span) -> Self
pub fn assignment_to_external_record_member( ty: impl Display, span: Span, ) -> Self
pub fn assignment_to_external_record_cond(ty: impl Display, span: Span) -> Self
pub fn assignment_to_external_record_tuple_cond( ty: impl Display, span: Span, ) -> Self
pub fn num_exit_codes() -> i32
Trait Implementations§
Source§impl Clone for TypeCheckerError
impl Clone for TypeCheckerError
Source§fn clone(&self) -> TypeCheckerError
fn clone(&self) -> TypeCheckerError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TypeCheckerError
impl Debug for TypeCheckerError
Source§impl Display for TypeCheckerError
impl Display for TypeCheckerError
Source§impl Error for TypeCheckerError
impl Error for TypeCheckerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<Backtraced> for TypeCheckerError
impl From<Backtraced> for TypeCheckerError
Source§fn from(source: Backtraced) -> Self
fn from(source: Backtraced) -> Self
Source§impl From<Formatted> for TypeCheckerError
impl From<Formatted> for TypeCheckerError
Source§impl From<TypeCheckerError> for LeoError
impl From<TypeCheckerError> for LeoError
Source§fn from(source: TypeCheckerError) -> Self
fn from(source: TypeCheckerError) -> Self
Source§impl LeoMessageCode for TypeCheckerError
Implements the trait for LeoError Codes.
impl LeoMessageCode for TypeCheckerError
Implements the trait for LeoError Codes.
Source§fn error_code(&self) -> String
fn error_code(&self) -> String
Source§fn warning_code(&self) -> String
fn warning_code(&self) -> String
Source§fn message_type() -> String
fn message_type() -> String
Source§fn code_identifier() -> i8
fn code_identifier() -> i8
Auto Trait Implementations§
impl Freeze for TypeCheckerError
impl RefUnwindSafe for TypeCheckerError
impl Send for TypeCheckerError
impl Sync for TypeCheckerError
impl Unpin for TypeCheckerError
impl UnwindSafe for TypeCheckerError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more