├── docs ├── news.rst ├── events.rst ├── faq.rst ├── _static │ └── images │ │ ├── logo@25x.png │ │ ├── logo@white.png │ │ └── remix-metamask │ │ ├── compile-panel.png │ │ ├── deploy-button.png │ │ ├── test-network.png │ │ ├── remix-console-1.png │ │ ├── remix-console-2.png │ │ ├── reverse-button.png │ │ ├── submit-create-transaction.png │ │ ├── submit-reverse-transaction.png │ │ └── after-submit-reverse-transaction.png └── _templates │ └── layout.html ├── .gitattributes ├── test ├── libsolidity │ ├── ASTJSON │ │ ├── smoke.sol │ │ ├── array_type_name.sol │ │ ├── enum_value.sol │ │ ├── event_definition.sol │ │ ├── placeholder_statement.sol │ │ ├── inheritance_specifier.sol │ │ ├── constructor.sol │ │ ├── fallback_payable.sol │ │ ├── non_utf8.sol │ │ ├── source_location.sol │ │ ├── using_for_directive.sol │ │ ├── fallback.sol │ │ ├── short_type_name.sol │ │ ├── short_type_name_ref.sol │ │ ├── long_type_name_binary_operation.sol │ │ ├── modifier_definition.sol │ │ ├── modifier_invocation.sol │ │ ├── long_type_name_identifier.sol │ │ └── function_type.sol │ ├── syntaxTests │ │ ├── parsing │ │ │ ├── empty_comment.sol │ │ │ ├── event.sol │ │ │ ├── event_arguments.sol │ │ │ ├── mapping.sol │ │ │ ├── smoke_test.sol │ │ │ ├── fallback_function.sol │ │ │ ├── interface_basic.sol │ │ │ ├── comment_end_with_double_star.sol │ │ │ ├── function_type_state_variable.sol │ │ │ ├── address_payable_constant.sol │ │ │ ├── arrays_in_events.sol │ │ │ ├── multi_arrays.sol │ │ │ ├── address_payable_library.sol │ │ │ ├── modifier_arguments.sol │ │ │ ├── event_arguments_indexed.sol │ │ │ ├── import_complex_without_from.sol │ │ │ ├── assembly_evmasm_type.sol │ │ │ ├── function_no_body.sol │ │ │ ├── function_type_as_storage_variable.sol │ │ │ ├── modifier.sol │ │ │ ├── address_in_struct.sol │ │ │ ├── empty_enum.sol │ │ │ ├── event_with_no_argument_list.sol │ │ │ ├── from_is_not_keyword.sol │ │ │ ├── import_complex_invalid_from.sol │ │ │ ├── import_invalid_token.sol │ │ │ ├── import_simple.sol │ │ │ ├── trailing_dot3.sol │ │ │ ├── constant_is_keyword.sol │ │ │ ├── external_variable.sol │ │ │ ├── var_array.sol │ │ │ ├── malformed_enum_declaration.sol │ │ │ ├── import_complex.sol │ │ │ ├── mapping_nonelementary_key_1.sol │ │ │ ├── fixed_literal_with_double_radix.sol │ │ │ ├── mapping_nonelementary_key_4.sol │ │ │ ├── missing_variable_name_in_declaration.sol │ │ │ ├── new_invalid_type_name.sol │ │ │ ├── var_storage_var.sol │ │ │ ├── external_function.sol │ │ │ ├── library_simple.sol │ │ │ ├── modifier_without_semicolon.sol │ │ │ ├── new_address_payable.sol │ │ │ ├── payable_accessor.sol │ │ │ ├── struct_definition.sol │ │ │ ├── address_public_payable_error.sol │ │ │ ├── emit_without_event.sol │ │ │ ├── location_specifiers_for_state_variables.sol │ │ │ ├── tuples_without_commas.sol │ │ │ ├── mapping_from_address_payable.sol │ │ │ ├── scientific_notation.sol │ │ │ ├── address_constant_payable.sol │ │ │ ├── arrays_in_storage.sol │ │ │ ├── function_type_as_parameter.sol │ │ │ ├── location_specifiers_with_var.sol │ │ │ ├── single_function_param_trailing_comma.sol │ │ │ ├── assembly_invalid_type.sol │ │ │ ├── while_loop.sol │ │ │ ├── address_nonpayable.sol │ │ │ ├── location_specifiers_for_state_variables_multi.sol │ │ │ ├── multiple_function_param_trailing_comma.sol │ │ │ ├── single_return_param_trailing_comma.sol │ │ │ ├── trailing_dot2.sol │ │ │ ├── invalid_fixed_conversion_leading_zeroes_check.sol │ │ │ ├── mapping_in_struct.sol │ │ │ ├── mapping_to_mapping_in_struct.sol │ │ │ ├── multiple_return_param_trailing_comma.sol │ │ │ ├── no_function_params.sol │ │ │ ├── single_event_arg_trailing_comma.sol │ │ │ ├── tuples_decl_without_rhs.sol │ │ │ ├── address_function_arguments_and_returns.sol │ │ │ ├── address_payable_type_expression.sol │ │ │ ├── conditional_with_assignment.sol │ │ │ ├── enum_valid_declaration.sol │ │ │ ├── inline_array_declaration.sol │ │ │ ├── lexer_numbers_with_underscores_fixed.sol │ │ │ ├── literal_constants_with_ether_subdenominations_in_expressions.sol │ │ │ ├── function_type_as_storage_variable_with_modifiers.sol │ │ │ ├── address_payable.sol │ │ │ ├── mapping_nonelementary_key_2.sol │ │ │ ├── mapping_nonelementary_key_3.sol │ │ │ ├── multiple_event_arg_trailing_comma.sol │ │ │ ├── single_modifier_arg_trailing_comma.sol │ │ │ ├── unary_plus_expression.sol │ │ │ ├── variable_definition_in_mapping.sol │ │ │ ├── address_payable_conversion.sol │ │ │ ├── enum_from_interface.sol │ │ │ ├── enum_from_library.sol │ │ │ ├── location_specifiers_for_locals.sol │ │ │ ├── multiple_modifier_arg_trailing_comma.sol │ │ │ ├── address_payable_struct.sol │ │ │ ├── calling_function.sol │ │ │ ├── enum_inheritance_contract.sol │ │ │ ├── enum_inheritance_interface.sol │ │ │ ├── tuples.sol │ │ │ ├── pragma_illegal.sol │ │ │ ├── trailing_dot1.sol │ │ │ ├── local_const_variable.sol │ │ │ └── constructor_super.sol │ │ ├── nameAndTypeResolution │ │ │ ├── 414_interface.sol │ │ │ ├── 228_valid_library.sol │ │ │ ├── 417_interface_events.sol │ │ │ ├── 506_large_storage_array_fine.sol │ │ │ ├── 422_interface_enums.sol │ │ │ ├── 187_large_utf8_codepoint.sol │ │ │ ├── 251_using_for_library.sol │ │ │ ├── 355_payable_external.sol │ │ │ ├── 526_fallback_marked_external.sol │ │ │ ├── 191_negative_integers_to_signed_min.sol │ │ │ ├── 084_events_with_same_name.sol │ │ │ ├── 458_shadowing_builtins_ignores_constructor.sol │ │ │ ├── 074_fallback_function.sol │ │ │ ├── 193_positive_integers_to_signed_out_of_bound_max.sol │ │ │ ├── 168_assignment_to_const_var_involving_conversion.sol │ │ │ ├── 169_assignment_to_const_var_involving_expression.sol │ │ │ ├── 419_interface_structs.sol │ │ │ ├── 438_unused_unnamed_function_parameter.sol │ │ │ ├── 457_shadowing_builtins_ignores_struct.sol │ │ │ ├── 497_gasleft.sol │ │ │ ├── 568_blockhash.sol │ │ │ ├── 086_events_with_same_name_different_types.sol │ │ │ ├── 170_assignment_to_const_var_involving_keccak.sol │ │ │ ├── 441_unused_unnamed_return_parameter.sol │ │ │ ├── 461_event_parameter_cannot_shadow_state_variable.sol │ │ │ ├── 085_events_with_same_name_unnamed_arguments.sol │ │ │ ├── 174_address_is_constant.sol │ │ │ ├── 415_interface_functions.sol │ │ │ ├── 421_interface_function_parameters.sol │ │ │ ├── 446_no_unused_warning_abstract_arguments.sol │ │ │ ├── 400_does_not_warn_msg_value_in_library.sol │ │ │ ├── 445_no_unused_warning_interface_arguments.sol │ │ │ ├── 524_accept_library_creation.sol │ │ │ ├── 560_event_emit_simple.sol │ │ │ ├── 442_named_return_parameter.sol │ │ │ ├── 515_experimental_pragma_empty.sol │ │ │ ├── 115_exp_warn_literal_base_3.sol │ │ │ ├── 268_function_overload_array_type.sol │ │ │ ├── 459_function_overload_is_not_shadowing.sol │ │ │ ├── 118_shift_warn_literal_base_3.sol │ │ │ ├── 398_does_not_warn_msg_value_in_payable_function.sol │ │ │ ├── 399_does_not_warn_msg_value_in_internal_function.sol │ │ │ ├── 453_shadowing_builtin_at_global_scope.sol │ │ │ ├── 082_anonymous_event_four_indexed.sol │ │ │ ├── 095_multiple_events_argument_clash.sol │ │ │ ├── 226_inheriting_library.sol │ │ │ ├── 227_library_having_variables.sol │ │ │ ├── 353_callcode_not_deprecated_as_function.sol │ │ │ ├── 418_interface_inheritance.sol │ │ │ ├── 420_interface_variables.sol │ │ │ ├── 431_bare_assert.sol │ │ │ ├── 001_name_references.sol │ │ │ ├── 139_no_name_suggestion.sol │ │ │ ├── 155_array_copy_with_different_types_static_dynamic.sol │ │ │ ├── 225_inheriting_from_library.sol │ │ │ ├── 460_function_override_is_not_shadowing.sol │ │ │ ├── 487_function_types_selector_4.sol │ │ │ ├── 154_array_copy_with_different_types_conversion_possible.sol │ │ │ ├── 157_array_of_undeclared_type.sol │ │ │ ├── 175_uninitialized_const_variable.sol │ │ │ ├── 252_using_for_not_library.sol │ │ │ ├── 423_using_interface.sol │ │ │ ├── 430_bare_selfdestruct.sol │ │ │ ├── 443_named_return_parameter_with_explicit_return.sol │ │ │ ├── 444_unnamed_return_parameter_with_explicit_return.sol │ │ │ ├── 516_experimental_pragma_unknown_number_literal.sol │ │ │ ├── 519_experimental_pragma_empy_string_literal.sol │ │ │ ├── 520_experimental_pragma_multiple_same_line.sol │ │ │ ├── 354_payable_in_library.sol │ │ │ ├── 357_payable_private.sol │ │ │ ├── 425_interface_implement_public_contract.sol │ │ │ ├── 447_no_unused_warnings.sol │ │ │ ├── 483_modifiers_access_storage_pointer.sol │ │ │ ├── 076_fallback_function_in_library.sol │ │ │ ├── 080_event.sol │ │ │ ├── 090_event_call.sol │ │ │ ├── 214_assignment_mem_storage_variable_directly.sol │ │ │ ├── 298_invalid_fixed_types_0x7_mxn.sol │ │ │ ├── 356_payable_internal.sol │ │ │ ├── 434_pure_statement_check_for_regular_for_loop.sol │ │ │ ├── 452_shadowing_builtins_with_storage_variables.sol │ │ │ ├── 456_shadowing_builtins_with_events.sol │ │ │ ├── 479_explicit_literal_to_memory_string_assignment.sol │ │ │ ├── 517_experimental_pragma_unknown_string_literal.sol │ │ │ ├── 529_fallback_marked_public.sol │ │ │ ├── 114_exp_warn_literal_base_2.sol │ │ │ ├── 119_shift_warn_literal_base_4.sol │ │ │ ├── 146_external_argument_assign.sol │ │ │ ├── 147_external_argument_increment.sol │ │ │ ├── 148_external_argument_delete.sol │ │ │ ├── 300_invalid_fixed_types_7x8_mxn.sol │ │ │ ├── 435_warn_unused_local.sol │ │ │ ├── 449_no_unused_inline_asm.sol │ │ │ ├── 511_library_function_without_implementation_public.sol │ │ │ ├── 527_fallback_marked_internal.sol │ │ │ ├── 528_fallback_marked_private.sol │ │ │ ├── 056_cyclic_inheritance.sol │ │ │ ├── 079_fallback_function_inheritance.sol │ │ │ ├── 117_shift_warn_literal_base_2.sol │ │ │ ├── 198_integer_boolean_not.sol │ │ │ ├── 324_fixed_points_inside_structs.sol │ │ │ ├── 401_does_not_warn_msg_value_in_modifier_following_non_payable_public_function.sol │ │ │ ├── 518_experimental_pragma_unknown_quoted_string_literal.sol │ │ │ ├── 104_empty_name_input_parameter.sol │ │ │ ├── 151_array_with_negative_length.sol │ │ │ ├── 172_assignment_to_const_string_bytes.sol │ │ │ ├── 245_tuples_empty_components.sol │ │ │ ├── 405_address_checksum_type_deduction.sol │ │ │ ├── 436_warn_unused_local_assigned.sol │ │ │ ├── 188_string_index.sol │ │ │ ├── 323_mapping_with_fixed_literal.sol │ │ │ ├── 450_shadowing_builtins_with_functions.sol │ │ │ ├── 561_event_emit_complex.sol │ │ │ ├── 077_fallback_function_with_return_parameters.sol │ │ │ ├── 106_empty_name_return_parameter.sol │ │ │ ├── 171_assignment_to_const_array_vars.sol │ │ │ ├── 307_rational_unary_minus_operation.sol │ │ │ ├── 429_revert_with_reason.sol │ │ │ ├── 470_specified_storage_no_warn.sol │ │ │ ├── 570_function_type_undeclared_type.sol │ │ │ ├── 015_balance_invalid.sol │ │ │ ├── 133_enum_duplicate_values.sol │ │ │ ├── 196_integer_boolean_or.sol │ │ │ ├── 197_integer_boolean_and.sol │ │ │ ├── 366_invalid_array_as_statement.sol │ │ │ ├── 402_assignment_to_constant.sol │ │ │ ├── 416_interface_function_bodies.sol │ │ │ ├── 501_gasleft_shadowing_2.sol │ │ │ ├── 521_experimental_pragma_test_warning.sol │ │ │ ├── 533_tuple_invalid_literal_too_large_exp.sol │ │ │ ├── 559_no_warning_for_using_members_that_look_like_address_members.sol │ │ │ ├── 584_abi_decode_with_tuple_of_other_than_types.sol │ │ │ ├── 006_type_checking_return.sol │ │ │ ├── 054_inheritance_basic.sol │ │ │ ├── 059_illegal_override_visibility.sol │ │ │ ├── 075_fallback_function_with_arguments.sol │ │ │ ├── 087_double_event_declaration.sol │ │ │ ├── 194_negative_integers_to_unsigned.sol │ │ │ ├── 201_integer_signed_exp_signed.sol │ │ │ ├── 265_new_for_non_array.sol │ │ │ ├── 482_explicit_literal_to_unspecified_string.sol │ │ │ ├── 512_library_function_without_implementation_internal.sol │ │ │ ├── 513_library_function_without_implementation_private.sol │ │ │ ├── 540_array_length_invalid_expression_division_by_zero.sol │ │ │ ├── 094_event_inheritance.sol │ │ │ ├── 110_no_overflow_with_large_literal.sol │ │ │ ├── 199_integer_unsigned_exp_signed.sol │ │ │ ├── 200_integer_signed_exp_unsigned.sol │ │ │ ├── 368_shift_constant_left_negative_rvalue.sol │ │ │ ├── 369_shift_constant_right_negative_rvalue.sol │ │ │ ├── 478_too_large_arrays_for_calldata_public.sol │ │ │ ├── 523_reject_interface_creation.sol │ │ │ ├── 536_array_length_invalid_expression_negative_bool.sol │ │ │ ├── 053_hash_collision_in_interface.sol │ │ │ ├── 081_event_too_many_indexed.sol │ │ │ ├── 165_assigning_state_to_const_variable.sol │ │ │ ├── 173_constant_struct.sol │ │ │ ├── 190_negative_integers_to_signed_out_of_bound.sol │ │ │ ├── 192_positive_integers_to_signed_out_of_bound.sol │ │ │ ├── 290_varM_disqualified_as_keyword_2.sol │ │ │ ├── 476_too_large_arrays_for_calldata_external.sol │ │ │ ├── 477_too_large_arrays_for_calldata_internal.sol │ │ │ ├── 488_function_types_selector_5.sol │ │ │ ├── 498_msg_gas_deprecated.sol │ │ │ ├── 534_tuple_invalid_literal_too_large_expression.sol │ │ │ ├── 537_array_length_invalid_expression_int_divides_bool.sol │ │ │ ├── 538_array_length_invalid_expression_bool_divides_int.sol │ │ │ ├── 571_function_type_undeclared_type_external.sol │ │ │ ├── 002_undeclared_name.sol │ │ │ ├── 004_reference_to_later_declaration.sol │ │ │ ├── 011_type_conversion_for_comparison_invalid.sol │ │ │ ├── 150_array_with_nonconstant_length.sol │ │ │ ├── 164_assigning_value_to_const_variable.sol │ │ │ ├── 195_positive_integers_to_unsigned_out_of_bound.sol │ │ │ ├── 235_abi_encode_with_large_integer_constant.sol │ │ │ ├── 279_break_not_in_loop.sol │ │ │ ├── 290_varM_disqualified_as_keyword_1.sol │ │ │ ├── 290_varM_disqualified_as_keyword_3.sol │ │ │ ├── 299_invalid_fixed_types_long_invalid_identifier.sol │ │ │ ├── 318_invalid_array_declaration_with_rational.sol │ │ │ ├── 342_missing_bool_conversion.sol │ │ │ ├── 372_shift_constant_right_fractional.sol │ │ │ ├── 562_event_emit_foreign_class.sol │ │ │ ├── 138_similar_name_suggestions_expected.sol │ │ │ ├── 144_no_spurious_identifier_suggestions.sol │ │ │ ├── 158_storage_variable_initialization_with_incorrect_type_int.sol │ │ │ ├── 219_memory_arrays_not_resizeable.sol │ │ │ ├── 338_rational_bitnot_unary_operation.sol │ │ │ ├── 370_shift_constant_left_excessive_rvalue.sol │ │ │ ├── 454_shadowing_builtins_with_parameters.sol │ │ │ ├── 563_event_without_emit_deprecated.sol │ │ │ ├── 088_double_event_declaration_ignores_anonymous.sol │ │ │ ├── 089_double_event_declaration_ignores_indexed.sol │ │ │ ├── 135_private_visibility.sol │ │ │ ├── 202_bytes_reference_compare_operators.sol │ │ │ ├── 206_storage_location_local_variables.sol │ │ │ ├── 280_continue_not_in_loop.sol │ │ │ ├── 350_unused_return_value_delegatecall.sol │ │ │ ├── 371_shift_constant_right_excessive_rvalue.sol │ │ │ ├── 426_throw_is_deprecated.sol │ │ │ ├── 428_bare_revert.sol │ │ │ ├── 433_pure_statement_in_for_loop.sol │ │ │ ├── 451_shadowing_builtins_with_variables.sol │ │ │ ├── 572_function_type_undeclared_type_multi_nested.sol │ │ │ ├── 078_fallback_function_twice.sol │ │ │ ├── 137_external_visibility.sol │ │ │ ├── 159_storage_variable_initialization_with_incorrect_type_string.sol │ │ │ ├── 331_rational_as_exponent_half.sol │ │ │ ├── 339_rational_bitor_binary_operation.sol │ │ │ ├── 351_callcode_deprecated.sol │ │ │ ├── 531_tuple_invalid_literal_too_large_unassigned.sol │ │ │ └── 539_array_length_invalid_expression_scientific_literal.sol │ │ ├── constructor │ │ ├── events │ │ │ ├── event_nested_array_2.sol │ │ │ ├── event_array_v2.sol │ │ │ ├── event_nested_array.sol │ │ │ └── event_nested_array_v2.sol │ │ ├── pragma │ │ │ ├── invalid_pragma.sol │ │ │ └── unknown_pragma.sol │ │ ├── types │ │ │ ├── mapping │ │ │ │ ├── mapping_dynamic_key.sol │ │ │ │ ├── library_argument_private.sol │ │ │ │ ├── argument_private.sol │ │ │ │ ├── library_argument_internal.sol │ │ │ │ ├── argument_internal.sol │ │ │ │ ├── library_array_argument_internal.sol │ │ │ │ ├── library_array_argument_private.sol │ │ │ │ ├── array_argument_internal.sol │ │ │ │ ├── array_argument_private.sol │ │ │ │ ├── function_type_argument_internal.sol │ │ │ │ ├── mapping_data_location_function_param_internal.sol │ │ │ │ ├── function_type_return_internal.sol │ │ │ │ ├── mapping_dynamic_key_public.sol │ │ │ │ ├── library_argument_public.sol │ │ │ │ ├── library_argument_external.sol │ │ │ │ ├── library_array_argument_public.sol │ │ │ │ ├── library_array_argument_external.sol │ │ │ │ ├── argument_public.sol │ │ │ │ └── library_return_private.sol │ │ │ ├── bytes0.sol │ │ │ ├── bytes256.sol │ │ │ ├── bytes33.sol │ │ │ ├── address │ │ │ │ ├── address_to_contract.sol │ │ │ │ ├── address_payable_selfdestruct.sol │ │ │ │ ├── contract_to_address.sol │ │ │ │ ├── uint_to_payable_address.sol │ │ │ │ ├── bytes_to_payable_address.sol │ │ │ │ ├── payable_address_to_address.sol │ │ │ │ ├── address_to_contract_payable_fallback.sol │ │ │ │ ├── address_abi_decode.sol │ │ │ │ ├── address_tuple_fine.sol │ │ │ │ ├── address_constant.sol │ │ │ │ └── contract_payable_fallback_to_payable_address.sol │ │ │ ├── index_access_for_bytes.sol │ │ │ ├── rational_negative_numerator_negative_exp.sol │ │ │ ├── contract_to_base.sol │ │ │ ├── var_empty_decl_3.sol │ │ │ ├── no_singleton_tuple.sol │ │ │ ├── contract_to_base_base.sol │ │ │ ├── function_call_fail2.sol │ │ │ ├── empty_tuple_event.sol │ │ │ ├── var_empty_decl_1.sol │ │ │ ├── rational_number_exp_limit_fine.sol │ │ │ └── uint256_to_bytes1.sol │ │ ├── visibility │ │ │ ├── interface │ │ │ │ ├── function_external.sol │ │ │ │ ├── function_internal.sol │ │ │ │ ├── function_private.sol │ │ │ │ └── function_public.sol │ │ │ └── function_no_visibility.sol │ │ ├── array │ │ │ ├── length │ │ │ │ ├── constant_var.sol │ │ │ │ ├── can_be_constant_in_struct.sol │ │ │ │ ├── can_be_recursive_constant.sol │ │ │ │ ├── too_large.sol │ │ │ │ ├── tuples.sol │ │ │ │ ├── inline_array.sol │ │ │ │ ├── invalid_expression_5.sol │ │ │ │ ├── bytes32_too_large.sol │ │ │ │ ├── const_cannot_be_fractional.sol │ │ │ │ ├── invalid_expression_1.sol │ │ │ │ ├── invalid_expression_2.sol │ │ │ │ ├── invalid_expression_3.sol │ │ │ │ ├── can_be_constant_in_function.sol │ │ │ │ ├── not_convertible_to_integer.sol │ │ │ │ ├── parameter_too_large.sol │ │ │ │ ├── uint_too_large_multidim.sol │ │ │ │ ├── bytes32_too_large_multidim.sol │ │ │ │ ├── invalid_expression_4.sol │ │ │ │ ├── cannot_be_function.sol │ │ │ │ ├── non_integer_constant_var.sol │ │ │ │ ├── pure_functions.sol │ │ │ │ └── cyclic_constant.sol │ │ │ ├── bytes_pop.sol │ │ │ ├── array_pop.sol │ │ │ ├── array_pop_arg.sol │ │ │ └── no_array_pop.sol │ │ ├── rule │ │ │ ├── empty_rule.sol │ │ │ ├── rule_fact_var.sol │ │ │ └── rule_fact.sol │ │ ├── viewPureChecker │ │ │ ├── creation_no_restrict_warning.sol │ │ │ ├── interface.sol │ │ │ ├── constant.sol │ │ │ ├── suggest_pure.sol │ │ │ ├── overriding_no_restrict_warning.sol │ │ │ └── suggest_view.sol │ │ ├── empty_struct.sol │ │ ├── modifiers │ │ │ ├── legal_modifier_override.sol │ │ │ ├── modifier_without_underscore.sol │ │ │ ├── function_modifier_double_invocation.sol │ │ │ ├── illegal_modifier_override.sol │ │ │ ├── modifier_returns_value.sol │ │ │ ├── function_modifier_invocation.sol │ │ │ └── function_modifier_invocation_local_variables.sol │ │ ├── conversion │ │ │ ├── conversion_to_bytes.sol │ │ │ ├── implicit_conversion_from_storage_array_ref.sol │ │ │ ├── allowed_conversion_to_bytes_array.sol │ │ │ ├── allowed_conversion_to_string.sol │ │ │ ├── function_type_pure_nonpayable.sol │ │ │ ├── function_type_pure_view.sol │ │ │ ├── not_allowed_conversion_to_int_array_pointer1.sol │ │ │ └── not_allowed_conversion_to_int_array_pointer2.sol │ │ ├── inheritance │ │ │ ├── override │ │ │ │ ├── function_state_variable.sol │ │ │ │ ├── state_variable_function.sol │ │ │ │ ├── add_view.sol │ │ │ │ └── remove_view.sol │ │ │ ├── allow_empty_duplicated_super_constructor_call.sol │ │ │ ├── base_arguments_no_parentheses.sol │ │ │ ├── duplicated_constructor_call │ │ │ │ └── base.sol │ │ │ └── disallow_modifier_style_without_parentheses.sol │ │ ├── structs │ │ │ └── recursion │ │ │ │ ├── struct_definition_not_really_recursive.sol │ │ │ │ ├── struct_definition_not_really_recursive_array.sol │ │ │ │ ├── struct_definition_directly_recursive_dynamic_array.sol │ │ │ │ ├── struct_definition_recursion_via_mapping.sol │ │ │ │ └── struct_definition_directly_recursive.sol │ │ ├── functionTypes │ │ │ ├── function_type.sol │ │ │ ├── external_function_type_to_address.sol │ │ │ ├── function_type_returned.sol │ │ │ ├── internal_function_as_external_parameter_in_library_internal.sol │ │ │ ├── warn_function_type_parameters_with_names.sol │ │ │ ├── call_value_on_payable_function_type.sol │ │ │ ├── delete_function_type_invalid.sol │ │ │ ├── payable_internal_function_type.sol │ │ │ ├── delete_external_function_type_invalid.sol │ │ │ ├── function_type_return_parameters_with_names.sol │ │ │ ├── external_function_type_taking_internal.sol │ │ │ ├── function_type_internal_public_variable.sol │ │ │ ├── external_function_type_returning_internal.sol │ │ │ ├── function_type_parameter.sol │ │ │ ├── private_function_type.sol │ │ │ └── public_function_type.sol │ │ ├── emit │ │ │ └── emit_empty.sol │ │ ├── inlineAssembly │ │ │ ├── assignment_from_functiontype.sol │ │ │ ├── assignment_from_library.sol │ │ │ ├── assignment_from_contract.sol │ │ │ ├── function_call_not_found.sol │ │ │ └── assignment_from_super.sol │ │ ├── scoping │ │ │ ├── scoping_for2.sol │ │ │ ├── scoping_for.sol │ │ │ ├── function_state_variable_conflict.sol │ │ │ ├── state_variable_function_conflict.sol │ │ │ ├── double_function_declaration.sol │ │ │ ├── name_shadowing.sol │ │ │ ├── double_variable_declaration_same_scope.sol │ │ │ ├── scoping.sol │ │ │ ├── scoping_self_use.sol │ │ │ ├── scoping_for_decl_in_body.sol │ │ │ ├── scoping_activation.sol │ │ │ └── scoping_old.sol │ │ ├── unterminatedBlocks │ │ │ ├── one_dot.sol │ │ │ ├── zero_dot.sol │ │ │ ├── one_dot_x.sol │ │ │ └── zero_dot_x.sol │ │ ├── dataLocations │ │ │ ├── libraryExternalFunction │ │ │ │ ├── function_argument_location_specifier_test_external_storage.sol │ │ │ │ └── function_argument_location_specifier_test_external_calldata.sol │ │ │ ├── publicFunction │ │ │ │ ├── function_argument_location_specifier_test_public_memory.sol │ │ │ │ └── public_function_parameters_no_data_location.sol │ │ │ ├── internalFunction │ │ │ │ ├── function_argument_location_specifier_test_internal_memory.sol │ │ │ │ └── function_argument_location_specifier_test_internal_storage.sol │ │ │ ├── libraryInternalFunction │ │ │ │ ├── function_argument_location_specifier_test_internal_memory.sol │ │ │ │ └── function_argument_location_specifier_test_internal_storage.sol │ │ │ ├── externalFunction │ │ │ │ └── function_argument_location_specifier_test_external_calldata.sol │ │ │ └── data_location_in_function_type.sol │ │ ├── literal_comparisons.sol │ │ ├── string │ │ │ ├── string_unterminated_no_new_line.sol │ │ │ ├── string_escapes.sol │ │ │ └── string_unterminated.sol │ │ ├── multiVariableDeclaration │ │ │ ├── multiSingleVariableDeclaration.sol │ │ │ └── oneElementTuple.sol │ │ ├── denominations │ │ │ └── deprecated_year.sol │ │ ├── constants │ │ │ ├── cyclic_dependency_1.sol │ │ │ ├── mod_div_rational.sol │ │ │ ├── cyclic_dependency_4.sol │ │ │ └── assign_constant_function_value.sol │ │ ├── controlFlow │ │ │ ├── storageReturn │ │ │ │ ├── unimplemented_library.sol │ │ │ │ └── unimplemented_internal.sol │ │ │ └── mappingReturn │ │ │ │ ├── named_fine.sol │ │ │ │ └── unnamed_fine.sol │ │ ├── double_stateVariable_declaration.sol │ │ ├── natspec │ │ │ ├── docstring_empty_tag.sol │ │ │ └── docstring_empty_description.sol │ │ ├── specialFunctions │ │ │ └── abidecode │ │ │ │ ├── abi_decode_single_return.sol │ │ │ │ ├── abi_decode_singletontuple.sol │ │ │ │ ├── abi_decode_simple.sol │ │ │ │ ├── abi_decode_empty.sol │ │ │ │ └── abi_decode_memory.sol │ │ ├── literalOperations │ │ │ ├── mod_zero.sol │ │ │ ├── division_by_zero.sol │ │ │ ├── division_by_zero_complex.sol │ │ │ └── mod_zero_complex.sol │ │ ├── tupleAssignments │ │ │ └── nowarn_swap_memory.sol │ │ ├── memberLookup │ │ │ └── msg_value_modifier_payable.sol │ │ ├── indexing │ │ │ ├── array_without_index.sol │ │ │ ├── fixedbytes_out_of_bounds_index.sol │ │ │ ├── fixedbytes_without_index.sol │ │ │ ├── array_out_of_bounds_index.sol │ │ │ ├── function_type.sol │ │ │ ├── function_type_without_index.sol │ │ │ └── array_negative_index.sol │ │ ├── fallback │ │ │ ├── pure_modifier.sol │ │ │ └── view_modifier.sol │ │ ├── smoke_test.sol │ │ ├── fixedPoints │ │ │ └── fixed_to_int │ │ │ │ └── explicit_allowed.sol │ │ ├── signed_rational_modulus.sol │ │ ├── upper_case_hex_literals.sol │ │ └── multiline_comments.sol │ └── smtCheckerTests │ │ ├── functions │ │ ├── functions_trivial_condition_for_only_call.sol │ │ ├── functions_trivial_condition_require_only_call.sol │ │ ├── functions_trivial_condition_while_only_call.sol │ │ ├── functions_trivial_condition_if.sol │ │ ├── functions_trivial_condition_require.sol │ │ ├── functions_trivial_condition_for.sol │ │ └── functions_trivial_condition_while.sol │ │ └── special │ │ ├── msg_sender_1.sol │ │ ├── blockhash.sol │ │ └── msg_sig.sol ├── libyul │ └── yulOptimizerTests │ │ ├── splitJoin │ │ └── smoke.yul │ │ ├── disambiguator │ │ ├── smoke.yul │ │ ├── smoke_yul.yul │ │ └── variables.yul │ │ ├── fullSimplify │ │ ├── smoke.yul │ │ ├── constants.yul │ │ ├── identity_rules_complex.yul │ │ ├── reversed.yul │ │ ├── mod_and_1.yul │ │ ├── constant_propagation.yul │ │ └── identity_rules_simple.yul │ │ ├── rematerialiser │ │ ├── smoke.yul │ │ └── trivial.yul │ │ ├── unusedPruner │ │ ├── smoke.yul │ │ ├── multi_declarations.yul │ │ ├── pop.yul │ │ ├── functions.yul │ │ ├── trivial.yul │ │ ├── multi_partial_assignments.yul │ │ ├── intermediate_assignment.yul │ │ ├── multi_assignments.yul │ │ └── multi_declare.yul │ │ ├── expressionJoiner │ │ ├── smoke.yul │ │ └── simple.yul │ │ ├── expressionSplitter │ │ └── smoke.yul │ │ ├── functionHoister │ │ ├── smoke.yul │ │ └── single.yul │ │ ├── expressionSimplifier │ │ ├── smoke.yul │ │ ├── constants.yul │ │ ├── reversed.yul │ │ ├── constant_propagation.yul │ │ ├── identity_rules_complex.yul │ │ ├── mod_and_1.yul │ │ ├── identity_rules_negative.yul │ │ ├── invariant.yul │ │ └── identity_rules_simple.yul │ │ ├── functionGrouper │ │ └── smoke.yul │ │ ├── commonSubexpressionEliminator │ │ ├── smoke.yul │ │ ├── non_movable_instr2.yul │ │ └── non_movable_instr.yul │ │ ├── mainFunction │ │ └── smoke.yul │ │ ├── varDeclPropagator │ │ ├── simple1.yul │ │ ├── overwrite.yul │ │ ├── rewrite_removes_unused_var.yul │ │ ├── use_before_init.yul │ │ └── split_assign_splits_vardecl.yul │ │ └── redundantAssignEliminator │ │ ├── simple.yul │ │ └── non_movable.yul ├── compilationTests │ ├── corion │ │ └── README.md │ ├── gnosis │ │ └── README.md │ ├── MultiSigWallet │ │ └── README.md │ ├── milestonetracker │ │ └── README.md │ └── stringutils │ │ └── README.md └── cmdlineErrorReports │ ├── too_long_line_left_short.sol │ ├── too_long_line_edge_in.sol │ └── too_long_line_edge_out.sol ├── scripts ├── codespell_whitelist.txt ├── bytecodecompare │ └── deploy_key.enc ├── travis-emscripten │ └── deploy_key.enc ├── isoltest.sh └── docker_build.sh ├── cmake ├── FindCLN.cmake └── FindGMP.cmake ├── liblll └── CMakeLists.txt ├── libevmasm └── CMakeLists.txt └── .dockerignore /docs/news.rst: -------------------------------------------------------------------------------- 1 | News 2 | ==== 3 | -------------------------------------------------------------------------------- /docs/events.rst: -------------------------------------------------------------------------------- 1 | Events 2 | ====== 3 | -------------------------------------------------------------------------------- /docs/faq.rst: -------------------------------------------------------------------------------- 1 | FAQ 2 | === 3 | 4 | .. _faq: 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.sol linguist-language=Solidity 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/smoke.sol: -------------------------------------------------------------------------------- 1 | contract C {} 2 | -------------------------------------------------------------------------------- /scripts/codespell_whitelist.txt: -------------------------------------------------------------------------------- 1 | iff 2 | nd 3 | assignend 4 | uint 5 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/array_type_name.sol: -------------------------------------------------------------------------------- 1 | contract C { uint[] i; } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/enum_value.sol: -------------------------------------------------------------------------------- 1 | contract C { enum E { A, B } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/event_definition.sol: -------------------------------------------------------------------------------- 1 | contract C { event E(); } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/placeholder_statement.sol: -------------------------------------------------------------------------------- 1 | contract C { modifier M { _; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/empty_comment.sol: -------------------------------------------------------------------------------- 1 | // 2 | contract test 3 | {} 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/event.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/inheritance_specifier.sol: -------------------------------------------------------------------------------- 1 | contract C1 {} contract C2 is C1 {} 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/414_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | } 3 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/constructor.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() public { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/fallback_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() external {} 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/non_utf8.sol: -------------------------------------------------------------------------------- 1 | contract C { function f() public { var x = hex"ff"; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/source_location.sol: -------------------------------------------------------------------------------- 1 | contract C { function f() { var x = 2; x++; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/using_for_directive.sol: -------------------------------------------------------------------------------- 1 | library L {} contract C { using L for uint; } 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/constructor.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() public {} } 2 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/splitJoin/smoke.yul: -------------------------------------------------------------------------------- 1 | {} 2 | // ---- 3 | // splitJoin 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/fallback.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() external payable { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/short_type_name.sol: -------------------------------------------------------------------------------- 1 | contract c { function f() public { uint[] memory x; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/short_type_name_ref.sol: -------------------------------------------------------------------------------- 1 | contract c { function f() public { uint[][] memory rows; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/228_valid_library.sol: -------------------------------------------------------------------------------- 1 | library Lib { uint constant x = 9; } 2 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/disambiguator/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // disambiguator 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // fullSimplify 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/rematerialiser/smoke.yul: -------------------------------------------------------------------------------- 1 | {} 2 | // ---- 3 | // rematerialiser 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // unusedPruner 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /docs/_static/images/logo@25x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/logo@25x.png -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/417_interface_events.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | event E(); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/event_arguments.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint a, bytes32 s); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | mapping(address => bytes32) names; 3 | } 4 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionJoiner/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // expressionJoiner 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /docs/_static/images/logo@white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/logo@white.png -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/long_type_name_binary_operation.sol: -------------------------------------------------------------------------------- 1 | contract c { function f() public { uint a = 2 + 3; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/modifier_definition.sol: -------------------------------------------------------------------------------- 1 | contract C { modifier M(uint i) { _; } function F() M(1) public {} } 2 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/modifier_invocation.sol: -------------------------------------------------------------------------------- 1 | contract C { modifier M(uint i) { _; } function F() M(1) public {} } 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/events/event_nested_array_2.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event E(uint[2][]); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/smoke_test.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVariable1; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSplitter/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // expressionSplitter 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/functionHoister/smoke.yul: -------------------------------------------------------------------------------- 1 | { 2 | } 3 | // ---- 4 | // functionHoister 5 | // { 6 | // } 7 | -------------------------------------------------------------------------------- /test/compilationTests/corion/README.md: -------------------------------------------------------------------------------- 1 | CORION contracts, originally from 2 | 3 | https://github.com/CORIONplatform/solidity 4 | -------------------------------------------------------------------------------- /test/compilationTests/gnosis/README.md: -------------------------------------------------------------------------------- 1 | Gnosis contracts, originally from 2 | 3 | https://github.com/gnosis/gnosis-contracts 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/fallback_function.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function() external { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/interface_basic.sol: -------------------------------------------------------------------------------- 1 | interface Interface { 2 | function f() external; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/pragma/invalid_pragma.sol: -------------------------------------------------------------------------------- 1 | pragma 0; 2 | // ---- 3 | // SyntaxError: (0-9): Invalid pragma "0" 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/mapping_dynamic_key.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string => uint) data; 3 | } 4 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/disambiguator/smoke_yul.yul: -------------------------------------------------------------------------------- 1 | // yul 2 | { } 3 | // ---- 4 | // disambiguator 5 | // { 6 | // } 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // expressionSimplifier 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /scripts/bytecodecompare/deploy_key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/scripts/bytecodecompare/deploy_key.enc -------------------------------------------------------------------------------- /scripts/travis-emscripten/deploy_key.enc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/scripts/travis-emscripten/deploy_key.enc -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/long_type_name_identifier.sol: -------------------------------------------------------------------------------- 1 | contract c { uint[] a; function f() public { uint[] storage b = a; } } 2 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/506_large_storage_array_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[2**64 - 1] x; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/comment_end_with_double_star.sol: -------------------------------------------------------------------------------- 1 | contract C1 { 2 | /** 3 | **/ 4 | } 5 | contract C2 {} 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/function_type_state_variable.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() x; 3 | function() y = x; 4 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/422_interface_enums.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | enum A { B, C } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address payable constant a = address(0); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/arrays_in_events.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint[10] a, bytes7[8] indexed b, c[3] x); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/multi_arrays.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(uint => mapping(uint => int8)[8][][9])[] x; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/visibility/interface/function_external.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/constant_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = 10; 3 | uint[LEN] ids; 4 | } 5 | // ---- -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/187_large_utf8_codepoint.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string s = "\xf0\x9f\xa6\x84"; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/251_using_for_library.sol: -------------------------------------------------------------------------------- 1 | library D { } 2 | contract C { 3 | using D for uint; 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/355_payable_external.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable external {} 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/526_fallback_marked_external.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () external { } 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | } 3 | contract C { 4 | using L for address payable; 5 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/modifier_arguments.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod(address a) { if (msg.sender == a) _; } 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/rule/empty_rule.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | rule "myRule" when { 3 | } then { 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/functionGrouper/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // functionGrouper 4 | // { 5 | // { 6 | // } 7 | // } 8 | -------------------------------------------------------------------------------- /test/compilationTests/MultiSigWallet/README.md: -------------------------------------------------------------------------------- 1 | MultiSigWallet contracts, originally from 2 | 3 | https://github.com/ConsenSys/MultiSigWallet 4 | -------------------------------------------------------------------------------- /test/compilationTests/milestonetracker/README.md: -------------------------------------------------------------------------------- 1 | Giveth milestone tracker, originally from 2 | 3 | https://github.com/Giveth/milestonetracker/ 4 | -------------------------------------------------------------------------------- /test/compilationTests/stringutils/README.md: -------------------------------------------------------------------------------- 1 | String utilities, originally from 2 | 3 | https://github.com/Arachnid/solidity-stringutils 4 | 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/191_negative_integers_to_signed_min.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public i = -128; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/event_arguments_indexed.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint a, bytes32 indexed s, bool indexed b); 3 | } 4 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/commonSubexpressionEliminator/smoke.yul: -------------------------------------------------------------------------------- 1 | { } 2 | // ---- 3 | // commonSubexpressionEliminator 4 | // { 5 | // } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/multi_declarations.yul: -------------------------------------------------------------------------------- 1 | { 2 | let x, y 3 | } 4 | // ---- 5 | // unusedPruner 6 | // { 7 | // } 8 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/pop.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := 1 3 | pop(a) 4 | } 5 | // ---- 6 | // unusedPruner 7 | // { 8 | // } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/084_events_with_same_name.sol: -------------------------------------------------------------------------------- 1 | contract TestIt { 2 | event A(); 3 | event A(uint i); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/458_shadowing_builtins_ignores_constructor.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() public {} 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/import_complex_without_from.sol: -------------------------------------------------------------------------------- 1 | import {hello, world}; 2 | // ---- 3 | // ParserError: (21-22): Expected "from". 4 | -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/compile-panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/compile-panel.png -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/deploy-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/deploy-button.png -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/test-network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/test-network.png -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/074_fallback_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function() external { x = 2; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/193_positive_integers_to_signed_out_of_bound_max.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public j = 127; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/assembly_evmasm_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly "evmasm" {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/function_no_body.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function functionName(bytes32 input) public returns (bytes32 out); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function (uint, uint) internal returns (uint) f1; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/pragma/unknown_pragma.sol: -------------------------------------------------------------------------------- 1 | pragma thisdoesntexist; 2 | // ---- 3 | // SyntaxError: (0-23): Unknown pragma "thisdoesntexist" 4 | -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/remix-console-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/remix-console-1.png -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/remix-console-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/remix-console-2.png -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/reverse-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/reverse-button.png -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/168_assignment_to_const_var_involving_conversion.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | C constant x = C(0x123); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/modifier.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod { if (msg.sender == 0x0000000000000000000000000000000000000000) _; } 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/creation_no_restrict_warning.sol: -------------------------------------------------------------------------------- 1 | contract D {} 2 | contract C { 3 | function f() public { new D(); } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/bytes_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes data; 3 | function test() public { 4 | data.pop(); 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/empty_struct.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct A {} 3 | } 4 | // ---- 5 | // SyntaxError: (17-28): Defining empty structs is disallowed. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/legal_modifier_override.sol: -------------------------------------------------------------------------------- 1 | contract A { modifier mod(uint a) { _; } } 2 | contract B is A { modifier mod(uint a) { _; } } 3 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/169_assignment_to_const_var_involving_expression.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant x = 0x123 + 0x456; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/419_interface_structs.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | struct A { 3 | int dummy; 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/438_unused_unnamed_function_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint) pure public { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/457_shadowing_builtins_ignores_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct a { 3 | uint msg; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/497_gasleft.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (uint256 val) { return gasleft(); } 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/568_blockhash.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (bytes32) { return blockhash(3); } 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_in_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { 3 | address payable a; 4 | address b; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_argument_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) private pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /cmake/FindCLN.cmake: -------------------------------------------------------------------------------- 1 | find_library(CLN_LIBRARY NAMES cln) 2 | include(FindPackageHandleStandardArgs) 3 | find_package_handle_standard_args(CLN DEFAULT_MSG CLN_LIBRARY) 4 | -------------------------------------------------------------------------------- /cmake/FindGMP.cmake: -------------------------------------------------------------------------------- 1 | find_library(GMP_LIBRARY NAMES gmp ) 2 | include(FindPackageHandleStandardArgs) 3 | find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY) 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/array_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] data; 3 | function test() public { 4 | data.pop(); 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/086_events_with_same_name_different_types.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint); 3 | event A(bytes); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/170_assignment_to_const_var_involving_keccak.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32 constant x = keccak256("abc"); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/441_unused_unnamed_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/461_event_parameter_cannot_shadow_state_variable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address a; 3 | event E(address a); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/empty_enum.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum foo { } 3 | } 4 | // ---- 5 | // ParserError: (25-26): enum with no members is not allowed. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/event_with_no_argument_list.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e; 3 | } 4 | // ---- 5 | // ParserError: (21-22): Expected '(' but got ';' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/from_is_not_keyword.sol: -------------------------------------------------------------------------------- 1 | // "from" is not a keyword although it is used as a keyword in import directives. 2 | contract from { 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/import_complex_invalid_from.sol: -------------------------------------------------------------------------------- 1 | import {hello, world} from function; 2 | // ---- 3 | // ParserError: (27-35): Expected import path. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/import_invalid_token.sol: -------------------------------------------------------------------------------- 1 | import function; 2 | // ---- 3 | // ParserError: (7-15): Expected string literal (path), "*" or alias list. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/import_simple.sol: -------------------------------------------------------------------------------- 1 | import "hello"; 2 | // ---- 3 | // ParserError: (0-15): Source "hello" not found: File not supplied initially. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/bytes0.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes0 b0 = 1; 3 | } 4 | // ---- 5 | // DeclarationError: (15-21): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/argument_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint) storage) private pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_argument_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /scripts/isoltest.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | REPO_ROOT="$(dirname "$0")"/.. 6 | exec ${REPO_ROOT}/build/test/tools/isoltest --testpath ${REPO_ROOT}/test 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/085_events_with_same_name_unnamed_arguments.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint); 3 | event A(uint, uint); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/174_address_is_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant x = 0x1212121212121212121212121212121212121212; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/415_interface_functions.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function() external; 3 | function f() external; 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/421_interface_function_parameters.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f(uint a) external returns (bool); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint a) pure public returns (uint b); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/trailing_dot3.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint a = 2. 3 | // ---- 4 | // ParserError: (29-29): Expected identifier but got end of source 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/bytes256.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes256 b256 = 1; 3 | } 4 | // ---- 5 | // DeclarationError: (15-23): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/bytes33.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes33 b33 = 1; 3 | } 4 | // ---- 5 | // DeclarationError: (15-22): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/argument_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint) storage) internal pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_array_argument_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_array_argument_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) private pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/submit-create-transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/submit-create-transaction.png -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/submit-reverse-transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/submit-reverse-transaction.png -------------------------------------------------------------------------------- /docs/_templates/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "!layout.html" %} 2 | 3 | {% block menu %} 4 | {{ super() }} 5 | Keyword Index 6 | {% endblock %} 7 | -------------------------------------------------------------------------------- /liblll/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources "*.cpp") 2 | file(GLOB headers "*.h") 3 | 4 | add_library(lll ${sources} ${headers}) 5 | target_link_libraries(lll PUBLIC evmasm devcore) 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/conversion_to_bytes.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (bytes memory) { 3 | return bytes("abc"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/override/function_state_variable.sol: -------------------------------------------------------------------------------- 1 | interface ERC20 { function x() external returns (uint); } 2 | contract C is ERC20 { uint public x; } 3 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/400_does_not_warn_msg_value_in_library.sol: -------------------------------------------------------------------------------- 1 | library C { 2 | function f() view public { 3 | msg.value; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/445_no_unused_warning_interface_arguments.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f(uint a) pure external returns (uint b); 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/524_accept_library_creation.sol: -------------------------------------------------------------------------------- 1 | library L {} 2 | contract C { 3 | function f() public { 4 | new L(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/560_event_emit_simple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event e(); 3 | function f() public { 4 | emit e(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/constant_is_keyword.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint constant = 4; 3 | } 4 | // ---- 5 | // ParserError: (30-31): Expected identifier but got '=' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/external_variable.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint external x; 3 | } 4 | // ---- 5 | // ParserError: (19-27): Expected identifier but got 'external' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/var_array.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function f() { var[] a; } 3 | } 4 | // ---- 5 | // ParserError: (34-35): Expected identifier but got '[' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | struct S1 { uint a; } 3 | struct S2 { S1 x; S1 y; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_to_contract.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (C c) { 3 | c = C(address(2)); 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/array_argument_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint)[] storage) internal pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/array_argument_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint)[] storage) private pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/constants.yul: -------------------------------------------------------------------------------- 1 | { let a := add(1, mul(3, 4)) } 2 | // ---- 3 | // expressionSimplifier 4 | // { 5 | // let a := 13 6 | // } 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/mainFunction/smoke.yul: -------------------------------------------------------------------------------- 1 | // yul 2 | {} 3 | // ---- 4 | // mainFunction 5 | // { 6 | // function main() 7 | // { 8 | // } 9 | // } 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/functions.yul: -------------------------------------------------------------------------------- 1 | { 2 | function f() { let a := 1 } 3 | function g() { f() } 4 | } 5 | // ---- 6 | // unusedPruner 7 | // { 8 | // } 9 | -------------------------------------------------------------------------------- /libevmasm/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB sources "*.cpp") 2 | file(GLOB headers "*.h") 3 | 4 | add_library(evmasm ${sources} ${headers}) 5 | target_link_libraries(evmasm PUBLIC devcore) 6 | -------------------------------------------------------------------------------- /test/libsolidity/ASTJSON/function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { function f(function() external payable returns (uint) x) returns (function() external view returns (uint)) {} } 2 | 3 | // ---- 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/implicit_conversion_from_storage_array_ref.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | int[10] x; 3 | int[] y; 4 | function f() public { 5 | y = x; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | function(uint) returns (uint) x; 4 | x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/allow_empty_duplicated_super_constructor_call.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() public { } } 2 | contract B is A { constructor() A() public { } } 3 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/442_named_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint a) { 3 | a = 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/515_experimental_pragma_empty.sol: -------------------------------------------------------------------------------- 1 | pragma experimental; 2 | // ---- 3 | // SyntaxError: (0-20): Experimental feature name is missing. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/malformed_enum_declaration.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum foo { WARNING,} 3 | } 4 | // ---- 5 | // ParserError: (33-34): Expected identifier after ',' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_payable_selfdestruct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(address payable a) public { 3 | selfdestruct(a); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/contract_to_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view { 3 | address a = address(this); 4 | a; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/index_access_for_bytes.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes20 x; 3 | function f(bytes16 b) public view { 4 | b[uint8(x[2])]; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/interface.sol: -------------------------------------------------------------------------------- 1 | interface D { 2 | function f() view external; 3 | } 4 | contract C is D { 5 | function f() view external {} 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/constructible_internal_constructor.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() internal {} 3 | } 4 | contract D is C { 5 | constructor() public { } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/emit/emit_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | emit; 4 | } 5 | } 6 | // ---- 7 | // ParserError: (45-46): Expected event name or path. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inlineAssembly/assignment_from_functiontype.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | let x := f 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/115_exp_warn_literal_base_3.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | return 2**80; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/268_function_overload_array_type.sol: -------------------------------------------------------------------------------- 1 | contract M { 2 | function f(uint[] memory) public; 3 | function f(int[] memory) public; 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/459_function_overload_is_not_shadowing.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public {} 3 | function f(uint) pure public {} 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/import_complex.sol: -------------------------------------------------------------------------------- 1 | import {hello, world} from "hello"; 2 | // ---- 3 | // ParserError: (0-35): Source "hello" not found: File not supplied initially. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_1.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(uint[] => uint) data; 3 | } 4 | // ---- 5 | // ParserError: (26-27): Expected '=>' but got '[' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_for2.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | for (uint x = 0; x < 10; x ++) 4 | x = 2; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/structs/recursion/struct_definition_not_really_recursive_array.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | struct S1 { uint a; } 3 | struct S2 { S1[1] x; S1[1] y; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/unterminatedBlocks/one_dot.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() pure public { 1. 3 | // ---- 4 | // ParserError: (47-47): Expected identifier but got end of source -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() pure public { 0. 3 | // ---- 4 | // ParserError: (47-47): Expected identifier but got end of source -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant x = 2; 3 | function k() pure public returns (uint) { 4 | return x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /docs/_static/images/remix-metamask/after-submit-reverse-transaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/second-state/lity/HEAD/docs/_static/images/remix-metamask/after-submit-reverse-transaction.png -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/can_be_constant_in_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = 10; 3 | struct Test { 4 | uint[LEN] ids; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/can_be_recursive_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant L = 5; 3 | uint constant LEN = L + 4 * L; 4 | uint[LEN] ids; 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes storage) external; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes memory) public; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/literal_comparisons.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(int8 x) public pure { 3 | if (x == 1) {} 4 | if (1 == x) {} 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/modifier_without_underscore.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | modifier m() {} 3 | } 4 | // ---- 5 | // SyntaxError: (33-35): Modifier body does not contain '_'. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/118_shift_warn_literal_base_3.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | return 2 << 80; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/398_does_not_warn_msg_value_in_payable_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() payable public { 3 | msg.value; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/399_does_not_warn_msg_value_in_internal_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() view internal { 3 | msg.value; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/453_shadowing_builtin_at_global_scope.sol: -------------------------------------------------------------------------------- 1 | contract msg { 2 | } 3 | // ---- 4 | // Warning: (0-16): This declaration shadows a builtin symbol. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/fixed_literal_with_double_radix.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | fixed40x40 pi = 3.14.15; 3 | } 4 | // ---- 5 | // ParserError: (34-37): Expected ';' but got 'Number' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_4.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string[] => uint) data; 3 | } 4 | // ---- 5 | // ParserError: (28-29): Expected '=>' but got '[' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/missing_variable_name_in_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 ; 3 | } 4 | // ---- 5 | // ParserError: (28-29): Expected identifier but got ';' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/new_invalid_type_name.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | new var; 4 | } 5 | } 6 | // ---- 7 | // ParserError: (35-38): Expected explicit type name. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/var_storage_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | var a; 3 | } 4 | // ---- 5 | // ParserError: (17-20): Function, variable, struct or modifier declaration expected. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/string/string_unterminated_no_new_line.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { "abc\ 3 | // ---- 4 | // ParserError: (47-53): Expected primary expression. -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/function_type_argument_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(function(mapping(uint=>uint) storage) internal) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/mapping_data_location_function_param_internal.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f4(mapping(uint => uint) memory) pure internal {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/rational_negative_numerator_negative_exp.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (int) { 3 | return (-1 / 2) ** -1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/reversed.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := add(0, mload(0)) 3 | } 4 | // ---- 5 | // expressionSimplifier 6 | // { 7 | // let a := mload(0) 8 | // } 9 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/varDeclPropagator/simple1.yul: -------------------------------------------------------------------------------- 1 | { 2 | let f 3 | f := mload(0) 4 | } 5 | // ---- 6 | // varDeclPropagator 7 | // { 8 | // let f := mload(0) 9 | // } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/external_constructor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor() external {} 3 | } 4 | // ---- 5 | // TypeError: (17-42): Constructor must be public or internal. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes memory) internal; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes calldata) external; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes memory) internal pure {} 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/external_function_type_to_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (address) { 3 | return address(this.f); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/multiVariableDeclaration/multiSingleVariableDeclaration.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() internal returns (uint) { 3 | (uint a) = f(); 4 | a; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/082_anonymous_event_four_indexed.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d) anonymous; 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/095_multiple_events_argument_clash.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e1(uint a, uint e1, uint e2); 3 | event e2(uint a, uint e1, uint e2); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/226_inheriting_library.sol: -------------------------------------------------------------------------------- 1 | contract Test {} 2 | library Lib is Test {} 3 | // ---- 4 | // TypeError: (17-39): Library is not allowed to inherit. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/227_library_having_variables.sol: -------------------------------------------------------------------------------- 1 | library Lib { uint x; } 2 | // ---- 3 | // TypeError: (14-20): Library cannot have non-constant state variables 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/353_callcode_not_deprecated_as_function.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function callcode() pure public { 3 | test.callcode(); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/418_interface_inheritance.sol: -------------------------------------------------------------------------------- 1 | interface A { 2 | } 3 | interface I is A { 4 | } 5 | // ---- 6 | // TypeError: (31-32): Interfaces cannot inherit. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/420_interface_variables.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | uint a; 3 | } 4 | // ---- 5 | // TypeError: (18-24): Variables cannot be declared in interfaces. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/431_bare_assert.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { assert; } 3 | } 4 | // ---- 5 | // Warning: (44-50): Statement has no effect. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/external_function.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function x() external {} 3 | } 4 | // ---- 5 | // Warning: (17-41): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/library_simple.sol: -------------------------------------------------------------------------------- 1 | library Lib { 2 | function f() public { } 3 | } 4 | // ---- 5 | // Warning: (18-41): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/modifier_without_semicolon.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod { if (msg.sender == 0) _ } 3 | } 4 | // ---- 5 | // ParserError: (52-53): Expected ';' but got '}' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/new_address_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns(address payable[] memory m) { 3 | m = new address payable[](10); 4 | } 5 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/payable_accessor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint payable x; 3 | } 4 | // ---- 5 | // ParserError: (22-29): State mutability can only be specified for address types. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/struct_definition.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | struct MyStructName { 4 | address addr; 5 | uint256 count; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/uint_to_payable_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint x) public pure returns (address payable) { 3 | return address(x); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/function_type_return_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(function() internal returns (mapping(uint=>uint) storage)) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # out-of-tree builds usually go here. This helps improving performance of uploading 2 | # the build context to the docker image build server 3 | /build 4 | 5 | # in-tree builds 6 | /deps 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/constructor_no_visibility.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() {} } 2 | // ---- 3 | // SyntaxError: (13-29): No visibility specified. Did you intend to add "public"? 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes calldata) external; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes storage) internal; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes storage) internal pure {} 3 | } 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/denominations/deprecated_year.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 3 years; 3 | } 4 | // ---- 5 | // TypeError: (32-39): Using "years" as a unit denomination is deprecated. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/function_modifier_double_invocation.sol: -------------------------------------------------------------------------------- 1 | contract B { 2 | function f(uint x) mod(x) mod(2) public pure { } 3 | modifier mod(uint a) { if (a > 0) _; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/001_name_references.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 variable; 3 | function f(uint256) public returns (uint out) { f(variable); test; out; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/139_no_name_suggestion.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function g() public { fun(); } 3 | } 4 | // ---- 5 | // DeclarationError: (39-42): Undeclared identifier. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/155_array_copy_with_different_types_static_dynamic.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint32[] a; 3 | uint8[80] b; 4 | function f() public { a = b; } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/225_inheriting_from_library.sol: -------------------------------------------------------------------------------- 1 | library Lib {} 2 | contract Test is Lib {} 3 | // ---- 4 | // TypeError: (32-35): Libraries cannot be inherited from. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/460_function_override_is_not_shadowing.sol: -------------------------------------------------------------------------------- 1 | contract D { function f() pure public {} } 2 | contract C is D { 3 | function f(uint) pure public {} 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/487_function_types_selector_4.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure external returns (bytes4) { 3 | return this.f.selector; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_public_payable_error.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address public payable a; 3 | } 4 | // ---- 5 | // ParserError: (32-39): Expected identifier but got 'payable' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/emit_without_event.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event A(); 3 | function f() { 4 | emit A; 5 | } 6 | } 7 | // ---- 8 | // ParserError: (49-50): Expected '(' but got ';' 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint[] memory x; 3 | } 4 | // ---- 5 | // ParserError: (23-29): Expected identifier but got 'memory' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/tuples_without_commas.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | var a = (2 2); 4 | } 5 | } 6 | // ---- 7 | // ParserError: (42-43): Expected ',' but got 'Number' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_for.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | for (uint x = 0; x < 10; x ++){ 4 | x = 2; 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/bytes_to_payable_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes20 x) public pure returns (address payable) { 3 | return address(x); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/constant_propagation.yul: -------------------------------------------------------------------------------- 1 | { let a := add(7, sub(mload(0), 7)) } 2 | // ---- 3 | // expressionSimplifier 4 | // { 5 | // let a := mload(0) 6 | // } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[8**90] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/tuples.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[(1,2)] a15; 3 | } 4 | // ---- 5 | // TypeError: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constants/cyclic_dependency_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = a; 3 | } 4 | // ---- 5 | // TypeError: (17-36): The value of the constant a has a cyclic dependency via a. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/constructor_without_implementation.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() public; 3 | } 4 | // ---- 5 | // TypeError: (14-35): Constructor must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() public returns(uint[] storage); 3 | function g() public returns(uint[] storage s); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/double_stateVariable_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 variable; 3 | uint128 variable; 4 | } 5 | // ---- 6 | // DeclarationError: (36-52): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/base_arguments_no_parentheses.sol: -------------------------------------------------------------------------------- 1 | contract Base { 2 | constructor(uint) public {} 3 | } 4 | contract Derived is Base(2) { } 5 | contract Derived2 is Base, Derived {} 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/154_array_copy_with_different_types_conversion_possible.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint32[] a; 3 | uint8[] b; 4 | function f() public { a = b; } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/157_array_of_undeclared_type.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | a[] public foo; 3 | } 4 | // ---- 5 | // DeclarationError: (17-18): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/175_uninitialized_const_variable.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint constant y; 3 | } 4 | // ---- 5 | // TypeError: (19-34): Uninitialized "constant" variable. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/252_using_for_not_library.sol: -------------------------------------------------------------------------------- 1 | contract D { } 2 | contract C { 3 | using D for uint; 4 | } 5 | // ---- 6 | // TypeError: (38-39): Library name expected. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/423_using_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | contract C is I { 5 | function f() public { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/430_bare_selfdestruct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { selfdestruct; } 3 | } 4 | // ---- 5 | // Warning: (44-56): Statement has no effect. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/443_named_return_parameter_with_explicit_return.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint a) { 3 | return 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/444_unnamed_return_parameter_with_explicit_return.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint) { 3 | return 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/516_experimental_pragma_unknown_number_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental 123; 2 | // ---- 3 | // SyntaxError: (0-24): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/519_experimental_pragma_empy_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental ""; 2 | // ---- 3 | // SyntaxError: (0-23): Empty experimental feature name is invalid. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/520_experimental_pragma_multiple_same_line.sol: -------------------------------------------------------------------------------- 1 | pragma experimental unsupportedName unsupportedName; 2 | // ---- 3 | // SyntaxError: (0-52): Stray arguments. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/natspec/docstring_empty_tag.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | /// @param 3 | function vote(uint id) public; 4 | } 5 | // ---- 6 | // DocstringParsingError: End of tag @param not found 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_from_address_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | mapping(address payable => uint) m; 3 | } 4 | // ---- 5 | // ParserError: (33-40): Expected '=>' but got 'payable' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/scientific_notation.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 a = 2e10; 3 | uint256 b = 2E10; 4 | uint256 c = 200e-2; 5 | uint256 d = 2E10 wei; 6 | uint256 e = 2.5e10; 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/contract_to_base.sol: -------------------------------------------------------------------------------- 1 | contract A {} 2 | contract B is A {} 3 | contract C { 4 | function f() public { 5 | A a = new B(); 6 | a; 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/suggest_pure.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function g() view public { } 3 | } 4 | // ---- 5 | // Warning: (17-45): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/visibility/interface/function_internal.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() internal; 3 | } 4 | // ---- 5 | // TypeError: (15-37): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/visibility/interface/function_private.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() private; 3 | } 4 | // ---- 5 | // TypeError: (15-36): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/visibility/interface/function_public.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() public; 3 | } 4 | // ---- 5 | // TypeError: (15-35): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul: -------------------------------------------------------------------------------- 1 | { let a := sub(calldataload(0), calldataload(0)) } 2 | // ---- 3 | // expressionSimplifier 4 | // { 5 | // let a := 0 6 | // } 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/constants.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := add(1, mul(3, 4)) 3 | mstore(0, a) 4 | } 5 | // ---- 6 | // fullSimplify 7 | // { 8 | // mstore(0, 13) 9 | // } 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/redundantAssignEliminator/simple.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a 3 | a := 1 4 | a := 2 5 | } 6 | // ---- 7 | // redundantAssignEliminator 8 | // { 9 | // let a 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/trivial.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := 1 3 | let b := 1 4 | mstore(0, 1) 5 | } 6 | // ---- 7 | // unusedPruner 8 | // { 9 | // mstore(0, 1) 10 | // } 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/inline_array.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[[2]] a15; 3 | } 4 | // ---- 5 | // TypeError: (22-25): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/invalid_expression_5.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[3/0] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/controlFlow/storageReturn/unimplemented_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() internal returns(uint[] storage); 3 | function g() internal returns(uint[] storage s); 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/function_type_returned.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (function(uint) pure external returns (uint) g) { 3 | return g; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/354_payable_in_library.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f() payable public {} 3 | } 4 | // ---- 5 | // TypeError: (19-49): Library functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/357_payable_private.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable private {} 3 | } 4 | // ---- 5 | // TypeError: (20-51): Internal functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/425_interface_implement_public_contract.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | contract C is I { 5 | function f() public { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/447_no_unused_warnings.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint a) pure public returns (uint b) { 3 | uint c = 1; 4 | b = a + c; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/483_modifiers_access_storage_pointer.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { uint a; } 3 | modifier m(S storage x) { 4 | x; 5 | _; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_constant_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant payable b = address(0); 3 | } 4 | // ---- 5 | // ParserError: (34-41): Expected identifier but got 'payable' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/arrays_in_storage.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint[10] a; 3 | uint[] a2; 4 | struct x { uint[2**20] b; y[1] c; } 5 | struct y { uint d; mapping(uint=>x)[] e; } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/function_type_as_parameter.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(function(uint) external returns (uint) g) internal returns (uint a) { 3 | return g(1); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/location_specifiers_with_var.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function f() { var memory x; } 3 | } 4 | // ---- 5 | // ParserError: (35-41): Location specifier needs explicit type name. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/single_function_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function(uint a,) {} 3 | } 4 | // ---- 5 | // ParserError: (32-33): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_single_return.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (bool) { 3 | return abi.decode("abc", (uint)) == 2; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_singletontuple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (uint) { 3 | return abi.decode("abc", (uint)); 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/overriding_no_restrict_warning.sol: -------------------------------------------------------------------------------- 1 | contract D { 2 | uint x; 3 | function f() public { x = 2; } 4 | } 5 | contract C is D { 6 | function f() public {} 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/visibility/function_no_visibility.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure { } 3 | } 4 | // ---- 5 | // SyntaxError: (17-38): No visibility specified. Did you intend to add "public"? 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/multi_partial_assignments.yul: -------------------------------------------------------------------------------- 1 | { 2 | let x, y 3 | x := 1 4 | } 5 | // ---- 6 | // unusedPruner 7 | // { 8 | // let x, y 9 | // x := 1 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/varDeclPropagator/overwrite.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a 3 | a := 4 4 | a := 5 5 | } 6 | // ---- 7 | // varDeclPropagator 8 | // { 9 | // let a := 4 10 | // a := 5 11 | // } 12 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/controlFlow/mappingReturn/named_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | mapping(uint=>uint) m; 3 | function f() internal view returns (mapping(uint=>uint) storage r) { r = m; } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/internal_function_as_external_parameter_in_library_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(function(uint) internal returns (uint) /*x*/) pure internal { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/warn_function_type_parameters_with_names.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(uint a) f; 3 | } 4 | // ---- 5 | // Warning: (26-32): Naming function type parameters is deprecated. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inlineAssembly/assignment_from_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | } 3 | 4 | contract C { 5 | function f() public pure { 6 | assembly { 7 | let x := L 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/literalOperations/mod_zero.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant b3 = 1 % 0; 3 | } 4 | // ---- 5 | // TypeError: (36-41): Operator % not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/076_fallback_function_in_library.sol: -------------------------------------------------------------------------------- 1 | library C { 2 | function() external {} 3 | } 4 | // ---- 5 | // TypeError: (16-38): Libraries cannot have fallback functions. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/080_event.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint indexed a, bytes3 indexed s, bool indexed b); 3 | function f() public { emit e(2, "abc", true); } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/090_event_call.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint a, bytes3 indexed s, bool indexed b); 3 | function f() public { emit e(2, "abc", true); } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/214_assignment_mem_storage_variable_directly.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] data; 3 | function f(uint[] memory x) public { 4 | data = x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | fixed0x7 a = .3; 3 | } 4 | // ---- 5 | // DeclarationError: (20-28): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/356_payable_internal.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable internal {} 3 | } 4 | // ---- 5 | // TypeError: (20-52): Internal functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/434_pure_statement_check_for_regular_for_loop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | for (uint x = 0; true; x++) 4 | {} 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/452_shadowing_builtins_with_storage_variables.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint msg; 3 | } 4 | // ---- 5 | // Warning: (17-25): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/456_shadowing_builtins_with_events.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event keccak256(); 3 | } 4 | // ---- 5 | // Warning: (17-35): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/479_explicit_literal_to_memory_string_assignment.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | string memory x = "abc"; 4 | x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/517_experimental_pragma_unknown_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental unsupportedName; 2 | // ---- 3 | // SyntaxError: (0-36): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/529_fallback_marked_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () public { } 3 | } 4 | // ---- 5 | // TypeError: (17-39): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/assembly_invalid_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly "failasm" {} 4 | } 5 | } 6 | // ---- 7 | // ParserError: (55-64): Only "evmasm" supported. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/while_loop.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function fun() public pure { 3 | uint256 x; 4 | while (true) { x = 1; break; continue; } x = 9; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_simple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (uint, bytes32, C) { 3 | return abi.decode("abc", (uint, bytes32, C)); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/tupleAssignments/nowarn_swap_memory.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { uint a; uint b; } 3 | function f() pure public { 4 | S memory x; 5 | S memory y; 6 | (x, y) = (y, x); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/bytes32_too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32[8**90] ids; 3 | } 4 | // ---- 5 | // TypeError: (25-30): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/const_cannot_be_fractional.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fixed constant L = 10.5; 3 | uint[L] ids; 4 | } 5 | // ---- 6 | // TypeError: (51-52): Array with fractional length specified. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/invalid_expression_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[-true] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/invalid_expression_2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[true/1] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/invalid_expression_3.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1/true] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/returns_in_constructor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor() public returns (uint a) { } 3 | } 4 | // ---- 5 | // TypeError: (46-54): Non-empty "returns" directive for constructor. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/controlFlow/mappingReturn/unnamed_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | mapping(uint=>uint) m; 3 | function f() internal view returns (mapping(uint=>uint) storage) { return m; } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/data_location_in_function_type.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | struct Nested { uint y; } 3 | function c(function(Nested memory) external returns (uint)[] storage) external pure {} 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 1 / 0; 3 | } 4 | // ---- 5 | // TypeError: (35-40): Operator / not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/memberLookup/msg_value_modifier_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | modifier costs(uint _amount) { require(msg.value >= _amount); _; } 3 | function f() costs(1 ether) public payable {} 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/114_exp_warn_literal_base_2.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint8 x = 100; 4 | return uint8(10)**x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/119_shift_warn_literal_base_4.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint8 x = 100; 4 | return 10 >> x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/146_external_argument_assign.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external { a = 1; } 3 | } 4 | // ---- 5 | // TypeError: (47-48): Expression has to be an lvalue. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/147_external_argument_increment.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external { a++; } 3 | } 4 | // ---- 5 | // TypeError: (47-48): Expression has to be an lvalue. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/148_external_argument_delete.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external { delete a; } 3 | } 4 | // ---- 5 | // TypeError: (54-55): Expression has to be an lvalue. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | fixed7x8 c = 3.12345678; 3 | } 4 | // ---- 5 | // DeclarationError: (20-28): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/435_warn_unused_local.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a; 4 | } 5 | } 6 | // ---- 7 | // Warning: (52-58): Unused local variable. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/449_no_unused_inline_asm.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a; 4 | assembly { 5 | a := 1 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/511_library_function_without_implementation_public.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | // This can be used as an "interface", hence it is allowed. 3 | function f() public; 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/527_fallback_marked_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () internal { } 3 | } 4 | // ---- 5 | // TypeError: (17-41): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/528_fallback_marked_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () private { } 3 | } 4 | // ---- 5 | // TypeError: (17-40): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/natspec/docstring_empty_description.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | /// @param id 3 | function vote(uint id) public; 4 | } 5 | // ---- 6 | // DocstringParsingError: No description given for param id 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_nonpayable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address a; 3 | function f(address b) public pure returns (address c) { 4 | address d = b; 5 | return d; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/location_specifiers_for_state_variables_multi.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint[] memory storage calldata x; 3 | } 4 | // ---- 5 | // ParserError: (23-29): Expected identifier but got 'memory' 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/multiple_function_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function(uint a, uint b,) {} 3 | } 4 | // ---- 5 | // ParserError: (40-41): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/single_return_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() returns (uint a,) {} 3 | } 4 | // ---- 5 | // ParserError: (43-44): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/trailing_dot2.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 a = 2.2e10; 3 | uint256 b = .5E10; 4 | uint256 c = 2 + 2.; 5 | } 6 | // ---- 7 | // ParserError: (76-77): Expected identifier but got ';' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/var_empty_decl_3.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | var (d, e,); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (52-63): Use of the "var" keyword is disallowed. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/can_be_constant_in_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = 10; 3 | function f() public pure { 4 | uint[LEN] memory a; 5 | a; 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/not_convertible_to_integer.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[true] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-26): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/parameter_too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes32[1263941234127518272] memory) public pure {} 3 | } 4 | // ---- 5 | // TypeError: (26-61): Array is too large to be encoded. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/uint_too_large_multidim.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[8**90][500] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/two_constructors.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor(uint) public { } 3 | constructor() public {} 4 | } 5 | // ---- 6 | // DeclarationError: (47-70): More than one constructor defined. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/call_value_on_payable_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function (uint) external payable returns (uint) x; 3 | function f() public { 4 | x.value(2)(1); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/delete_function_type_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | delete f; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (54-55): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/array_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes memory a; 4 | a[]; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (61-64): Index expression cannot be omitted. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/fixedbytes_out_of_bounds_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes32 b; 4 | b[64]; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (56-61): Out of bounds array access. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/fixedbytes_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes32 b; 4 | b[]; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (56-59): Index expression cannot be omitted. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/056_cyclic_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract A is B { } 2 | contract B is A { } 3 | // ---- 4 | // TypeError: (14-15): Definition of base has to precede definition of derived contract 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/079_fallback_function_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint x; 3 | function() external { x = 1; } 4 | } 5 | contract C is A { 6 | function() external { x = 2; } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/117_shift_warn_literal_base_2.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint8 x = 100; 4 | return uint8(10) << x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/198_integer_boolean_not.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { uint x = 1; !x; } } 2 | // ---- 3 | // TypeError: (50-52): Unary operator ! cannot be applied to type uint256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/324_fixed_points_inside_structs.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct myStruct { 3 | ufixed a; 4 | int b; 5 | } 6 | myStruct a = myStruct(3.125, 3); 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/401_does_not_warn_msg_value_in_modifier_following_non_payable_public_function.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() pure public { } 3 | modifier m() { msg.value; _; } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/518_experimental_pragma_unknown_quoted_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental "unsupportedName"; 2 | // ---- 3 | // SyntaxError: (0-38): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/invalid_fixed_conversion_leading_zeroes_check.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() { 3 | fixed a = 1.0x2; 4 | } 5 | } 6 | // ---- 7 | // ParserError: (44-47): Expected primary expression. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/payable_address_to_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(address payable a) public pure { 3 | address payable b; 4 | address c = a; 5 | c = b; 6 | } 7 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/no_singleton_tuple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | uint a; 4 | (a,) = (uint(1),); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (60-70): Tuple component cannot be empty. 9 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_1.yul: -------------------------------------------------------------------------------- 1 | { 2 | mstore(0, mod(calldataload(0), exp(2, 8))) 3 | } 4 | // ---- 5 | // expressionSimplifier 6 | // { 7 | // mstore(0, and(calldataload(0), 255)) 8 | // } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/bytes32_too_large_multidim.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32[8**90][500] ids; 3 | } 4 | // ---- 5 | // TypeError: (25-30): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constants/mod_div_rational.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fixed a1 = 0.1 % -0.4271087646484375; 3 | fixed a2 = 0.1 % 0.4271087646484375; 4 | fixed a3 = 0 / 0.123; 5 | fixed a4 = 0 / -0.123; 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/array_out_of_bounds_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes[32] memory a; 4 | a[64]; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (65-70): Out of bounds array access. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | f[0]; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/104_empty_name_input_parameter.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(uint) public { } 3 | } 4 | // ---- 5 | // Warning: (20-47): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/151_array_with_negative_length.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) public { uint8[-1] x; } 3 | } 4 | // ---- 5 | // TypeError: (51-53): Array with negative length specified. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/172_assignment_to_const_string_bytes.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes constant a = "\x00\x01\x02"; 3 | bytes constant b = hex"000102"; 4 | string constant c = "hello"; 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/245_tuples_empty_components.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | (1,,2); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (47-53): Tuple component cannot be empty. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/405_address_checksum_type_deduction.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | (0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E).transfer(2); 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/436_warn_unused_local_assigned.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a = 1; 4 | } 5 | } 6 | // ---- 7 | // Warning: (52-58): Unused local variable. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_in_struct.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct test_struct { 3 | address addr; 4 | uint256 count; 5 | mapping(bytes32 => test_struct) self_reference; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_to_mapping_in_struct.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct test_struct { 3 | address addr; 4 | mapping (uint64 => mapping (bytes32 => uint)) complex_mapping; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/multiple_return_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() returns (uint a, uint b,) {} 3 | } 4 | // ---- 5 | // ParserError: (54-55): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/no_function_params.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | function functionName() public {} 4 | } 5 | // ---- 6 | // Warning: (36-69): Function state mutability can be restricted to pure 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/single_event_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event Test(uint a,); 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError: (34-35): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/tuples_decl_without_rhs.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | (uint a, uint b, uint c); 4 | } 5 | } 6 | // ---- 7 | // ParserError: (76-77): Expected '=' but got ';' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/function_state_variable_conflict.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint) public pure {} 3 | uint public f = 0; 4 | } 5 | // ---- 6 | // DeclarationError: (53-70): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/state_variable_function_conflict.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public f = 0; 3 | function f(uint) public pure {} 4 | } 5 | // ---- 6 | // DeclarationError: (40-71): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive_dynamic_array.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | struct MyStructName { 3 | address addr; 4 | MyStructName[] x; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/intermediate_assignment.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := 1 3 | a := 4 4 | let b := 1 5 | } 6 | // ---- 7 | // unusedPruner 8 | // { 9 | // let a := 1 10 | // a := 4 11 | // } 12 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/varDeclPropagator/rewrite_removes_unused_var.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a, b 3 | a := mload(0) 4 | } 5 | // ---- 6 | // varDeclPropagator 7 | // { 8 | // let b 9 | // let a := mload(0) 10 | // } 11 | -------------------------------------------------------------------------------- /test/cmdlineErrorReports/too_long_line_left_short.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(announcementType Type, string Announcement, string Link, bool Oppositable, string _str, uint256 _uint, address _addr) onlyOwner external { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/invalid_expression_4.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1.111111E1111111111111] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-44): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/fallback/pure_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function() external pure { x = 2; } 4 | } 5 | // ---- 6 | // TypeError: (29-64): Fallback function must be payable or non-payable, but is "pure". 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/fallback/view_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function() external view { x = 2; } 4 | } 5 | // ---- 6 | // TypeError: (29-64): Fallback function must be payable or non-payable, but is "view". 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/payable_internal_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function (uint) internal payable returns (uint) x; 3 | } 4 | // ---- 5 | // TypeError: (17-66): Only external function types can be payable. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 1 / ((1+3)-4); 3 | } 4 | // ---- 5 | // TypeError: (35-48): Operator / not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant b3 = 1 % (-4+((2)*2)); 3 | } 4 | // ---- 5 | // TypeError: (36-52): Operator % not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/188_string_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string s; 3 | function f() public { bytes1 a = s[2]; } 4 | } 5 | // ---- 6 | // TypeError: (64-68): Index access for string is not possible. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/323_mapping_with_fixed_literal.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | mapping(ufixed8x1 => string) fixedString; 3 | function f() public { 4 | fixedString[0.5] = "Half"; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/450_shadowing_builtins_with_functions.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function keccak256() pure public {} 3 | } 4 | // ---- 5 | // Warning: (17-52): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/561_event_emit_complex.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event e(uint a, string b); 3 | function f() public { 4 | emit e(2, "abc"); 5 | emit e({b: "abc", a: 8}); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_function_arguments_and_returns.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(address) public pure returns (address) {} 3 | function g(address payable) public pure returns (address payable) {} 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable_type_expression.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | address payable; 4 | } 5 | } 6 | // ---- 7 | // ParserError: (67-68): Expected identifier but got ';' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/conditional_with_assignment.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function f() public pure { 3 | uint y = 1; 4 | uint x = 3 < 0 ? y = 3 : 6; 5 | true ? x = 3 : 4; 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/enum_valid_declaration.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum validEnum { Value1, Value2, Value3, Value4 } 3 | constructor() public { 4 | a = validEnum.Value3; 5 | } 6 | validEnum a; 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/inline_array_declaration.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint[] a; 3 | function f() public returns (uint, uint) { 4 | a = [1,2,3]; 5 | return (a[3], [2,3,4][0]); 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/lexer_numbers_with_underscores_fixed.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | fixed f1 = 3.14_15; 4 | fixed f2 = 3_1.4_15; 5 | 6 | f1; f2; 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | constructor() public 3 | { 4 | a = 1 wei * 100 wei + 7 szabo - 3; 5 | } 6 | uint256 a; 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | abi.decode("abc", ()); 4 | } 5 | } 6 | // ---- 7 | // Warning: (52-73): Statement has no effect. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/contract_to_base_base.sol: -------------------------------------------------------------------------------- 1 | contract A {} 2 | contract B is A {} 3 | contract C is B {} 4 | contract D { 5 | function f() public { 6 | A a = new C(); 7 | a; 8 | } 9 | } 10 | // ---- 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/function_call_fail2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint y) public pure returns (uint) { 3 | (f(y)) = 2; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (74-78): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/mapping_dynamic_key_public.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string => uint) public data; 3 | } 4 | // ---- 5 | // TypeError: (14-49): Dynamically-sized keys for public mappings are not supported. 6 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/identity_rules_complex.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := sub(calldataload(0), calldataload(0)) 3 | mstore(a, 0) 4 | } 5 | // ---- 6 | // fullSimplify 7 | // { 8 | // mstore(0, 0) 9 | // } 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/reversed.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := add(0, mload(0)) 3 | mstore(0, a) 4 | } 5 | // ---- 6 | // fullSimplify 7 | // { 8 | // let _1 := 0 9 | // mstore(_1, mload(_1)) 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/multi_assignments.yul: -------------------------------------------------------------------------------- 1 | { 2 | let x, y 3 | x := 1 4 | y := 2 5 | } 6 | // ---- 7 | // unusedPruner 8 | // { 9 | // let x, y 10 | // x := 1 11 | // y := 2 12 | // } 13 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/varDeclPropagator/use_before_init.yul: -------------------------------------------------------------------------------- 1 | { 2 | let b 3 | let a := b 4 | b := 1 5 | } 6 | // ---- 7 | // varDeclPropagator 8 | // { 9 | // let b 10 | // let a := b 11 | // b := 1 12 | // } 13 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/delete_external_function_type_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | delete this.f; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (54-60): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/illegal_modifier_override.sol: -------------------------------------------------------------------------------- 1 | contract A { modifier mod(uint a) { _; } } 2 | contract B is A { modifier mod(uint8 a) { _; } } 3 | // ---- 4 | // TypeError: (61-89): Override changes modifier signature. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/077_fallback_function_with_return_parameters.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() external returns (uint) { } 3 | } 4 | // ---- 5 | // TypeError: (45-51): Fallback function cannot return values. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/106_empty_name_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public returns (bool) { } 3 | } 4 | // ---- 5 | // Warning: (20-58): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/171_assignment_to_const_array_vars.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[3] constant x = [uint(1), 2, 3]; 3 | } 4 | // ---- 5 | // TypeError: (17-53): Constants of non-value type not yet implemented. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/307_rational_unary_minus_operation.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | ufixed16x2 a = 3.25; 4 | fixed16x2 b = -3.25; 5 | a; b; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/429_revert_with_reason.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint x) pure public { 3 | if (x > 7) 4 | revert("abc"); 5 | else 6 | revert(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/470_specified_storage_no_warn.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { uint a; string b; } 3 | S x; 4 | function f() view public { 5 | S storage y = x; 6 | y; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/570_function_type_undeclared_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function a(function(Nested)) external pure {} 3 | } 4 | // ---- 5 | // DeclarationError: (37-43): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/function_type_as_storage_variable_with_modifiers.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function (uint, uint) modifier1() returns (uint) f1; 3 | } 4 | // ---- 5 | // ParserError: (66-68): Expected '{' but got identifier 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/rule/rule_fact_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct Person { 3 | int age; 4 | } 5 | 6 | rule "myRule" when { 7 | p: Person(age > 10); 8 | } then { 9 | } 10 | } 11 | // ---- 12 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_to_contract_payable_fallback.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (C c) { 3 | c = C(address(2)); 4 | } 5 | function() external payable { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_argument_public.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) public pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (27-56): Type is required to live outside storage. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/unterminatedBlocks/one_dot_x.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 1.x; } 3 | } 4 | // ---- 5 | // TypeError: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 1. -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/unterminatedBlocks/zero_dot_x.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 0.x; } 3 | } 4 | // ---- 5 | // TypeError: (47-50): Member "x" not found or not visible after argument-dependent lookup in int_const 0. -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/viewPureChecker/suggest_view.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function g() public returns (uint) { return x; } 4 | } 5 | // ---- 6 | // Warning: (29-77): Function state mutability can be restricted to view 7 | -------------------------------------------------------------------------------- /test/cmdlineErrorReports/too_long_line_edge_in.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function ffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Ty, string A) onlyOwner external { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/cmdlineErrorReports/too_long_line_edge_out.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function fffffffffffffffffffffff(announcementTypeTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT Typ, string A) onlyOwner external { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for_only_call.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { for (;x;) {} } 6 | function g() public pure { f(true); } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/cannot_be_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public {} 3 | uint[f] ids; 4 | } 5 | // ---- 6 | // TypeError: (49-50): Invalid array length, expected integer literal or constant expression. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/allowed_conversion_to_bytes_array.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes a; 3 | bytes b; 4 | function f() public view { 5 | bytes storage c = a; 6 | bytes memory d = b; 7 | d = bytes(c); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/allowed_conversion_to_string.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string a; 3 | string b; 4 | function f() public view { 5 | string storage c = a; 6 | string memory d = b; 7 | d = string(c); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/function_type_return_parameters_with_names.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(uint) returns (bool ret) f; 3 | } 4 | // ---- 5 | // SyntaxError: (41-49): Return parameters in function types may not be named. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/function_type_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | f[]; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (41-42): Indexed expression has to be a type, mapping or array (is function ()) 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/multiVariableDeclaration/oneElementTuple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | (uint a,) = (1,); 4 | a; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (59-63): Tuple component cannot be empty. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/015_balance_invalid.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function fun() public { 3 | address(0).balance = 7; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (52-70): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/133_enum_duplicate_values.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | enum ActionChoices { GoLeft, GoRight, GoLeft, Sit } 3 | } 4 | // ---- 5 | // DeclarationError: (66-72): Identifier already declared. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/196_integer_boolean_or.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { uint x = 1; uint y = 2; x || y; } } 2 | // ---- 3 | // TypeError: (62-68): Operator || not compatible with types uint256 and uint256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/197_integer_boolean_and.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { uint x = 1; uint y = 2; x && y; } } 2 | // ---- 3 | // TypeError: (62-68): Operator && not compatible with types uint256 and uint256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/366_invalid_array_as_statement.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct S { uint x; } 3 | constructor(uint k) public { S[k]; } 4 | } 5 | // ---- 6 | // TypeError: (76-77): Integer constant expected. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/402_assignment_to_constant.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint constant a = 1; 3 | function f() public { a = 2; } 4 | } 5 | // ---- 6 | // TypeError: (64-65): Cannot assign to a constant variable. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/416_interface_function_bodies.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (18-52): Functions in interfaces cannot have an implementation. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/501_gasleft_shadowing_2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint gasleft; 3 | function f() public { gasleft = 42; } 4 | } 5 | // ---- 6 | // Warning: (17-29): This declaration shadows a builtin symbol. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/521_experimental_pragma_test_warning.sol: -------------------------------------------------------------------------------- 1 | pragma experimental __test; 2 | // ---- 3 | // Warning: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/533_tuple_invalid_literal_too_large_exp.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | (2**270, 1); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (53-59): Invalid rational number. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/559_no_warning_for_using_members_that_look_like_address_members.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function transfer(uint) public; 3 | function f() public { 4 | this.transfer(10); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/584_abi_decode_with_tuple_of_other_than_types.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { abi.decode("", (0)); } 3 | } 4 | // ---- 5 | // TypeError: (60-61): Argument has to be a type name. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address payable a; 3 | function f(address payable b) public pure returns (address payable c) { 4 | address payable d = b; 5 | return d; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_2.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | struct S { 3 | uint x; 4 | } 5 | mapping(S => uint) data; 6 | } 7 | // ---- 8 | // ParserError: (47-48): Expected elementary type name for mapping key type 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/mapping_nonelementary_key_3.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | struct S { 3 | string s; 4 | } 5 | mapping(S => uint) data; 6 | } 7 | // ---- 8 | // ParserError: (49-50): Expected elementary type name for mapping key type 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/multiple_event_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event Test(uint a, uint b,); 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError: (45-46): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/single_modifier_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | modifier modTest(uint a,) { _; } 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError: (40-41): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/unary_plus_expression.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(uint x) pure public { 3 | uint y = +x; 4 | y; 5 | } 6 | } 7 | // ---- 8 | // SyntaxError: (70-72): Use of unary + is disallowed. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/variable_definition_in_mapping.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function fun() { 3 | mapping(var=>bytes32) d; 4 | } 5 | } 6 | // ---- 7 | // ParserError: (44-47): Expected elementary type name for mapping key type 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/smoke_test.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVariable1; 3 | function fun(uint256 arg1) public { uint256 y; y = arg1; } 4 | } 5 | // ---- 6 | // Warning: (42-100): Function state mutability can be restricted to pure 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/string/string_escapes.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (bytes32) { 3 | bytes32 escapeCharacters = "\t\b\n\r\f\'\"\\\b"; 4 | return escapeCharacters; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_abi_decode.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes memory b) public pure returns (address payable) { 3 | (address payable c) = abi.decode(b, (address)); 4 | return c; 5 | } 6 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/empty_tuple_event.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event SomeEvent(); 3 | function a() public { 4 | (emit SomeEvent(), 7); 5 | } 6 | } 7 | // ---- 8 | // ParserError: (71-75): Expected primary expression. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_argument_external.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) external pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (27-56): Type is required to live outside storage. 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionJoiner/simple.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := mload(2) 3 | let x := calldataload(a) 4 | sstore(x, 3) 5 | } 6 | // ---- 7 | // expressionJoiner 8 | // { 9 | // sstore(calldataload(mload(2)), 3) 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_negative.yul: -------------------------------------------------------------------------------- 1 | { let a := sub(calldataload(1), calldataload(0)) } 2 | // ---- 3 | // expressionSimplifier 4 | // { 5 | // let a := sub(calldataload(1), calldataload(0)) 6 | // } 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/mod_and_1.yul: -------------------------------------------------------------------------------- 1 | { 2 | mstore(0, mod(calldataload(0), exp(2, 8))) 3 | } 4 | // ---- 5 | // fullSimplify 6 | // { 7 | // let _4 := 0 8 | // mstore(_4, and(calldataload(_4), 255)) 9 | // } 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/redundantAssignEliminator/non_movable.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a 3 | a := 0 4 | a := mload(0) 5 | } 6 | // ---- 7 | // redundantAssignEliminator 8 | // { 9 | // let a 10 | // a := mload(0) 11 | // } 12 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require_only_call.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { require(x); } 6 | function g() public pure { f(true); } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while_only_call.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { while (x) {} } 6 | function g() public pure { f(true); } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/special/msg_sender_1.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f() public view { 6 | address a = msg.sender; 7 | address b = msg.sender; 8 | assert(a == b); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constants/cyclic_dependency_4.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = b * c; 3 | uint constant b = 7; 4 | uint constant c = 4 + uint(keccak256(abi.encode(d))); 5 | uint constant d = 2 + b; 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/external_function_type_taking_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(function () internal) external x; 3 | } 4 | // ---- 5 | // TypeError: (26-47): Internal type cannot be used for external function type. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inlineAssembly/assignment_from_contract.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | let x := C 5 | } 6 | } 7 | } 8 | // ---- 9 | // TypeError: (72-73): Expected a library. 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inlineAssembly/function_call_not_found.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | k() 5 | } 6 | } 7 | } 8 | // ---- 9 | // DeclarationError: (63-64): Function not found. 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/006_type_checking_return.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public returns (bool r) { return 1 >= 2; } 3 | } 4 | // ---- 5 | // Warning: (20-75): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/054_inheritance_basic.sol: -------------------------------------------------------------------------------- 1 | contract base { uint baseMember; struct BaseType { uint element; } } 2 | contract derived is base { 3 | BaseType data; 4 | function f() public { baseMember = 7; } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/059_illegal_override_visibility.sol: -------------------------------------------------------------------------------- 1 | contract B { function f() internal {} } 2 | contract C is B { function f() public {} } 3 | // ---- 4 | // TypeError: (58-80): Overriding function visibility differs. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/075_fallback_function_with_arguments.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function(uint a) external { x = 2; } 4 | } 5 | // ---- 6 | // TypeError: (37-45): Fallback function cannot take parameters. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/087_double_event_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint i); 3 | event A(uint i); 4 | } 5 | // ---- 6 | // DeclarationError: (20-36): Event with same name and arguments defined twice. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/194_negative_integers_to_unsigned.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint8 public x = -1; 3 | } 4 | // ---- 5 | // TypeError: (37-39): Type int_const -1 is not implicitly convertible to expected type uint8. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/201_integer_signed_exp_signed.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { int x = -3; int y = -4; x ** y; } } 2 | // ---- 3 | // TypeError: (62-68): Operator ** not compatible with types int256 and int256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/265_new_for_non_array.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint size) public { 3 | uint x = new uint(7); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (65-73): Contract or array type expected. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/482_explicit_literal_to_unspecified_string.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | string("abc"); 4 | } 5 | } 6 | // ---- 7 | // Warning: (52-65): Statement has no effect. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/512_library_function_without_implementation_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() internal; 3 | } 4 | // ---- 5 | // TypeError: (16-38): Internal library function must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/513_library_function_without_implementation_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() private; 3 | } 4 | // ---- 5 | // TypeError: (16-37): Internal library function must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/540_array_length_invalid_expression_division_by_zero.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[3/0] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-25): Operator / not compatible with types int_const 3 and int_const 0 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/structs/recursion/struct_definition_recursion_via_mapping.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | struct MyStructName1 { 3 | address addr; 4 | uint256 count; 5 | mapping(uint => MyStructName1) x; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_array_argument_public.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) public pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (27-58): Type is required to live outside storage. 7 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/invariant.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := mload(sub(7, 7)) 3 | let b := sub(a, 0) 4 | } 5 | // ---- 6 | // expressionSimplifier 7 | // { 8 | // let a := mload(0) 9 | // let b := a 10 | // } 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/non_integer_constant_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bool constant LEN = true; 3 | uint[LEN] ids; 4 | } 5 | // ---- 6 | // TypeError: (52-55): Invalid array length, expected integer literal or constant expression. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/fixedPoints/fixed_to_int/explicit_allowed.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | ufixed a = 4; 3 | fixed b = -4; 4 | 5 | uint i1 = uint(a); 6 | uint i2 = uint(b); 7 | int i3 = int(a); 8 | int i4 = int(b); 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/094_event_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract base { 2 | event e(uint a, bytes3 indexed s, bool indexed b); 3 | } 4 | contract c is base { 5 | function f() public { emit e(2, "abc", true); } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/110_no_overflow_with_large_literal.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | constructor() public { 3 | a = 115792089237316195423570985008687907853269984665640564039458; 4 | } 5 | uint256 a; 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/199_integer_unsigned_exp_signed.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { uint x = 3; int y = -4; x ** y; } } 2 | // ---- 3 | // TypeError: (62-68): Operator ** not compatible with types uint256 and int256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/200_integer_signed_exp_unsigned.sol: -------------------------------------------------------------------------------- 1 | contract test { function() external { uint x = 3; int y = -4; y ** x; } } 2 | // ---- 3 | // TypeError: (62-68): Operator ** not compatible with types int256 and uint256 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/368_shift_constant_left_negative_rvalue.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public a = 0x42 << -8; 3 | } 4 | // ---- 5 | // TypeError: (33-43): Operator << not compatible with types int_const 66 and int_const -8 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/369_shift_constant_right_negative_rvalue.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public a = 0x42 >> -8; 3 | } 4 | // ---- 5 | // TypeError: (33-43): Operator >> not compatible with types int_const 66 and int_const -8 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/478_too_large_arrays_for_calldata_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint[85678901234] memory a) pure public { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (28-54): Array is too large to be encoded. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/523_reject_interface_creation.sol: -------------------------------------------------------------------------------- 1 | interface I {} 2 | contract C { 3 | function f() public { 4 | new I(); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (62-67): Cannot instantiate an interface. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/536_array_length_invalid_expression_negative_bool.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[-true] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable_conversion.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | address payable a = address payable(this); 4 | } 5 | } 6 | // ---- 7 | // ParserError: (80-87): Expected ';' but got 'payable' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/enum_from_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | enum Direction { Left, Right } 3 | } 4 | 5 | contract D { 6 | function f() public pure returns (I.Direction) { 7 | return I.Direction.Left; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/enum_from_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | enum Direction { Left, Right } 3 | } 4 | 5 | contract D { 6 | function f() public pure returns (L.Direction) { 7 | return L.Direction.Left; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/double_function_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function fun() public { } 3 | function fun() public { } 4 | } 5 | // ---- 6 | // DeclarationError: (20-45): Function with same name and arguments defined twice. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/name_shadowing.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 variable; 3 | function f() pure public { uint32 variable; variable = 2; } 4 | } 5 | // ---- 6 | // Warning: (69-84): This declaration shadows an existing declaration. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/signed_rational_modulus.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure { 3 | fixed a = 0.42578125 % -0.4271087646484375; 4 | fixed b = .5 % a; 5 | fixed c = a % b; 6 | a; b; c; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_array_argument_external.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) external pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (27-58): Type is required to live outside storage. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/var_empty_decl_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | var a; 4 | a.NeverReachedByParser(); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (52-57): Use of the "var" keyword is disallowed. 9 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_simple.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := mload(0) 3 | let b := sub(a, a) 4 | } 5 | // ---- 6 | // expressionSimplifier 7 | // { 8 | // let a := mload(0) 9 | // let b := 0 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/constant_propagation.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := add(7, sub(mload(0), 7)) 3 | mstore(a, 0) 4 | } 5 | // ---- 6 | // fullSimplify 7 | // { 8 | // let _2 := 0 9 | // mstore(mload(_2), _2) 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/functionHoister/single.yul: -------------------------------------------------------------------------------- 1 | // yul 2 | { 3 | let a:u256 4 | function f() {} 5 | } 6 | // ---- 7 | // functionHoister 8 | // { 9 | // let a:u256 10 | // function f() 11 | // { 12 | // } 13 | // } 14 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/rematerialiser/trivial.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := 1 3 | let b := a 4 | mstore(0, b) 5 | } 6 | // ---- 7 | // rematerialiser 8 | // { 9 | // let a := 1 10 | // let b := 1 11 | // mstore(0, 1) 12 | // } 13 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_if.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | contract C 3 | { 4 | function f(bool x) public pure { require(x); if (x) {} } 5 | } 6 | // ---- 7 | // Warning: (95-96): Condition is always true. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/events/event_array_v2.sol: -------------------------------------------------------------------------------- 1 | pragma experimental ABIEncoderV2; 2 | contract c { 3 | event E(uint[]); 4 | } 5 | // ---- 6 | // Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/function_type_internal_public_variable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(bytes memory) internal public a; 3 | } 4 | // ---- 5 | // TypeError: (17-57): Internal or recursive type is not allowed for public state variables. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/override/state_variable_function.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint public x; 3 | } 4 | contract C is A { 5 | function x() public returns (uint); 6 | } 7 | // ---- 8 | // DeclarationError: (50-85): Identifier already declared. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inlineAssembly/assignment_from_super.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | let x := super 5 | } 6 | } 7 | } 8 | // ---- 9 | // DeclarationError: (72-77): Identifier not found. 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/modifier_returns_value.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function f(uint a) mod(2) public returns (uint r) { } 3 | modifier mod(uint a) { _; return 7; } 4 | } 5 | // ---- 6 | // TypeError: (101-109): Return arguments not allowed. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/053_hash_collision_in_interface.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function gsf() public { } 3 | function tgeo() public { } 4 | } 5 | // ---- 6 | // TypeError: (0-78): Function signature hash collision for tgeo() 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/081_event_too_many_indexed.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint indexed a, bytes3 indexed b, bool indexed c, uint indexed d); 3 | } 4 | // ---- 5 | // TypeError: (17-91): More than 3 indexed arguments for event. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/165_assigning_state_to_const_variable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant x = msg.sender; 3 | } 4 | // ---- 5 | // TypeError: (38-48): Initial value for constant variable has to be compile-time constant. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/173_constant_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { uint x; uint[] y; } 3 | S constant x = S(5, new uint[](4)); 4 | } 5 | // ---- 6 | // TypeError: (52-86): Constants of non-value type not yet implemented. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/190_negative_integers_to_signed_out_of_bound.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public i = -129; 3 | } 4 | // ---- 5 | // TypeError: (36-40): Type int_const -129 is not implicitly convertible to expected type int8. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/192_positive_integers_to_signed_out_of_bound.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public j = 128; 3 | } 4 | // ---- 5 | // TypeError: (36-39): Type int_const 128 is not implicitly convertible to expected type int8. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_2.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | intM should = 4; 4 | } 5 | } 6 | // ---- 7 | // DeclarationError: (50-54): Identifier not found or not unique. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/476_too_large_arrays_for_calldata_external.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint[85678901234] calldata a) pure external { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (28-56): Array is too large to be encoded. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/477_too_large_arrays_for_calldata_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint[85678901234] memory a) pure internal { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (28-54): Array is too large to be encoded. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/488_function_types_selector_5.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function h() pure external { 3 | } 4 | function f() pure external returns (bytes4) { 5 | return this.h.selector; 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/498_msg_gas_deprecated.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (uint256 val) { return msg.gas; } 3 | } 4 | // ---- 5 | // TypeError: (73-80): "msg.gas" has been deprecated in favor of "gasleft()" 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/534_tuple_invalid_literal_too_large_expression.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | ((2**270) / 2**100, 1); 4 | } 5 | } 6 | // ---- 7 | // Warning: (52-74): Statement has no effect. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/537_array_length_invalid_expression_int_divides_bool.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[true/1] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/538_array_length_invalid_expression_bool_divides_int.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1/true] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/571_function_type_undeclared_type_external.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function a(function(Nested) external) external pure {} 3 | } 4 | // ---- 5 | // DeclarationError: (37-43): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/location_specifiers_for_locals.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint[] m_x; 3 | function f() public view { 4 | uint[] storage x = m_x; 5 | uint[] memory y; 6 | x; y; 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/multiple_modifier_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | modifier modTest(uint a, uint b,) { _; } 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError: (51-52): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/double_variable_declaration_same_scope.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | uint x; 4 | uint x; 5 | } 6 | } 7 | // ---- 8 | // DeclarationError: (71-77): Identifier already declared. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | { 4 | uint256 x; 5 | } 6 | x = 2; 7 | } 8 | } 9 | // ---- 10 | // DeclarationError: (93-94): Undeclared identifier. 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_self_use.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | uint a = a; 4 | } 5 | } 6 | // ---- 7 | // DeclarationError: (64-65): Undeclared identifier. "a" is not (or not yet) visible at this point. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/string/string_unterminated.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (bytes32) { 3 | bytes32 escapeCharacters = "This a test 4 | } 5 | } 6 | // ---- 7 | // ParserError: (100-112): Expected primary expression. -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_tuple_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (address payable a, address b) { 3 | (address c, address payable d) = (address(this), address(0)); 4 | (a,b) = (d,c); 5 | } 6 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/pure_functions.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = keccak256(ripemd160(33)); 3 | uint[LEN] ids; 4 | } 5 | // ---- 6 | // TypeError: (72-75): Invalid array length, expected integer literal or constant expression. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constructor/library_constructor.sol: -------------------------------------------------------------------------------- 1 | library Lib { 2 | constructor() public; 3 | } 4 | // ---- 5 | // TypeError: (15-36): Constructor cannot be defined in libraries. 6 | // TypeError: (15-36): Constructor must be implemented if declared. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/external_function_type_returning_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() external returns (function () internal) x; 3 | } 4 | // ---- 5 | // TypeError: (46-67): Internal type cannot be used for external function type. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/duplicated_constructor_call/base.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor(uint) public { } } 2 | contract B is A(2) { constructor() A(3) public { } } 3 | // ---- 4 | // DeclarationError: (79-83): Base constructor arguments given twice. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/override/add_view.sol: -------------------------------------------------------------------------------- 1 | contract B { function f() public {} } 2 | contract C is B { function f() public view {} } 3 | // ---- 4 | // TypeError: (56-83): Overriding function changes state mutability from "nonpayable" to "view". 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/override/remove_view.sol: -------------------------------------------------------------------------------- 1 | contract B { function f() public view {} } 2 | contract C is B { function f() public {} } 3 | // ---- 4 | // TypeError: (61-83): Overriding function changes state mutability from "view" to "nonpayable". 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/002_undeclared_name.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 variable; 3 | function f(uint256 arg) public { 4 | f(notfound); 5 | } 6 | } 7 | // ---- 8 | // DeclarationError: (85-93): Undeclared identifier. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/004_reference_to_later_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function g() public { f(); } 3 | function f() public {} 4 | } 5 | // ---- 6 | // Warning: (53-75): Function state mutability can be restricted to pure 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/011_type_conversion_for_comparison_invalid.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { int32(2) == uint64(2); } 3 | } 4 | // ---- 5 | // TypeError: (42-63): Operator == not compatible with types int32 and uint64 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/150_array_with_nonconstant_length.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) public { uint8[a] x; } 3 | } 4 | // ---- 5 | // TypeError: (51-52): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/164_assigning_value_to_const_variable.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function changeIt() public { x = 9; } 3 | uint constant x = 56; 4 | } 5 | // ---- 6 | // TypeError: (48-49): Cannot assign to a constant variable. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/195_positive_integers_to_unsigned_out_of_bound.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint8 public x = 700; 3 | } 4 | // ---- 5 | // TypeError: (37-40): Type int_const 700 is not implicitly convertible to expected type uint8. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/235_abi_encode_with_large_integer_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { abi.encode(2**500); } 3 | } 4 | // ---- 5 | // TypeError: (55-61): Invalid rational number (too large or division by zero). 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/279_break_not_in_loop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | if (true) 4 | break; 5 | } 6 | } 7 | // ---- 8 | // SyntaxError: (69-74): "break" has to be in a "for" or "while" loop. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_1.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | uintM something = 3; 4 | } 5 | } 6 | // ---- 7 | // DeclarationError: (50-55): Identifier not found or not unique. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/290_varM_disqualified_as_keyword_3.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | bytesM fail = "now"; 4 | } 5 | } 6 | // ---- 7 | // DeclarationError: (50-56): Identifier not found or not unique. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/299_invalid_fixed_types_long_invalid_identifier.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | fixed99999999999999999999999999999999999999x7 b = 9.5; 3 | } 4 | // ---- 5 | // DeclarationError: (20-65): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/318_invalid_array_declaration_with_rational.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | uint[3.5] a; a; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (55-58): Array with fractional length specified. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/342_missing_bool_conversion.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function b(uint a) public { 3 | bool(a == 1); 4 | } 5 | } 6 | // ---- 7 | // Warning: (20-75): Function state mutability can be restricted to pure 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/372_shift_constant_right_fractional.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public a = 0x42 >> (1 / 2); 3 | } 4 | // ---- 5 | // TypeError: (33-48): Operator >> not compatible with types int_const 66 and rational_const 1 / 2 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/562_event_emit_foreign_class.sol: -------------------------------------------------------------------------------- 1 | contract A { event e(uint a, string b); } 2 | contract C is A { 3 | function f() public { 4 | emit A.e(2, "abc"); 5 | emit A.e({b: "abc", a: 8}); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/address_payable_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { 3 | address payable a; 4 | address payable[] b; 5 | mapping(uint => address payable) c; 6 | mapping(uint => address payable[]) d; 7 | } 8 | } -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/calling_function.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | function() returns(function() returns(function() returns(function() returns(uint)))) x; 4 | uint y; 5 | y = x()()()(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/enum_inheritance_contract.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | enum Direction { Left, Right } 3 | } 4 | 5 | contract D is C { 6 | function f() public pure returns (Direction) { 7 | return Direction.Left; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/enum_inheritance_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | enum Direction { Left, Right } 3 | } 4 | 5 | contract D is I { 6 | function f() public pure returns (Direction) { 7 | return Direction.Left; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/tuples.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | uint a = (1); 4 | (uint b,) = (1,2); 5 | (uint c, uint d) = (1, 2 + a); 6 | (uint e,) = (1, b); 7 | (a) = 3; 8 | a;b;c;d;e; 9 | } 10 | } 11 | // ---- 12 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_memory.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | abi.decode("abc", (bytes memory, uint[][2] memory)); 4 | } 5 | } 6 | // ---- 7 | // ParserError: (71-77): Expected ',' but got 'memory' 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/upper_case_hex_literals.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | 3 | function f() public pure returns (uint256) { 4 | uint256 a = 0x1234aAbcC; 5 | uint256 b = 0x1234ABCDEF; 6 | return a + b; 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr2.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := gas() 3 | let b := gas() 4 | } 5 | // ---- 6 | // commonSubexpressionEliminator 7 | // { 8 | // let a := gas() 9 | // let b := gas() 10 | // } 11 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/fullSimplify/identity_rules_simple.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := mload(0) 3 | mstore(0, sub(a, a)) 4 | } 5 | // ---- 6 | // fullSimplify 7 | // { 8 | // let _1 := 0 9 | // pop(mload(_1)) 10 | // mstore(_1, 0) 11 | // } 12 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/varDeclPropagator/split_assign_splits_vardecl.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a, b 3 | a := mload(0) 4 | b := mload(1) 5 | } 6 | // ---- 7 | // varDeclPropagator 8 | // { 9 | // let a := mload(0) 10 | // let b := mload(1) 11 | // } 12 | -------------------------------------------------------------------------------- /scripts/docker_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set -e 4 | 5 | docker build -t ethereum/solc:build -f scripts/Dockerfile . 6 | tmp_container=$(docker create ethereum/solc:build sh) 7 | mkdir -p upload 8 | docker cp ${tmp_container}:/usr/bin/solc upload/solc-static-linux 9 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_require.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { x = true; require(x); } 6 | } 7 | // ---- 8 | // Warning: (98-99): Condition is always true. 9 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/special/blockhash.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f() public payable { 6 | assert(blockhash(2) > 0); 7 | } 8 | } 9 | // ---- 10 | // Warning: (79-103): Assertion violation happens here 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/array_pop_arg.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] data; 3 | function test() public { 4 | data.pop(5); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (65-76): Wrong argument count for function call: 1 arguments given but expected 0. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/constants/assign_constant_function_value.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () pure returns (uint) x; 3 | uint constant y = x(); 4 | } 5 | // ---- 6 | // TypeError: (74-77): Initial value for constant variable has to be compile-time constant. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/events/event_nested_array.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event E(uint[][]); 3 | } 4 | // ---- 5 | // TypeError: (25-33): This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/events/event_nested_array_v2.sol: -------------------------------------------------------------------------------- 1 | pragma experimental ABIEncoderV2; 2 | contract c { 3 | event E(uint[][]); 4 | } 5 | // ---- 6 | // Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/indexing/array_negative_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes[32] memory a; 4 | a[-1]; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (67-69): Type int_const -1 is not implicitly convertible to expected type uint256. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/function_modifier_invocation.sol: -------------------------------------------------------------------------------- 1 | contract B { 2 | function f() mod1(2, true) mod2("0123456") pure public { } 3 | modifier mod1(uint a, bool b) { if (b) _; } 4 | modifier mod2(bytes7 a) { while (a == "1234567") _; } 5 | } 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/multiline_comments.sol: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a multi-line comment 3 | * it should create no problems 4 | * 5 | */ 6 | 7 | contract test { 8 | /* 9 | * this is another multi-line comment 10 | * 11 | */ 12 | } 13 | // ---- 14 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/138_similar_name_suggestions_expected.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function func() public {} 3 | function g() public { fun(); } 4 | } 5 | // ---- 6 | // DeclarationError: (69-72): Undeclared identifier. Did you mean "func"? 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/144_no_spurious_identifier_suggestions.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function g() public { 3 | uint va = 1; 4 | uint vb = x; 5 | } 6 | } 7 | // ---- 8 | // DeclarationError: (78-79): Undeclared identifier. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/158_storage_variable_initialization_with_incorrect_type_int.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint8 a = 1000; 3 | } 4 | // ---- 5 | // TypeError: (27-31): Type int_const 1000 is not implicitly convertible to expected type uint8. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/219_memory_arrays_not_resizeable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | uint[] memory x; 4 | x.length = 2; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (72-80): Expression has to be an lvalue. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/338_rational_bitnot_unary_operation.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | ~fixed(3.5); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (50-61): Unary operator ~ cannot be applied to type fixed128x18 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/370_shift_constant_left_excessive_rvalue.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public a = 0x42 << 0x100000000; 3 | } 4 | // ---- 5 | // TypeError: (33-52): Operator << not compatible with types int_const 66 and int_const 4294967296 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/454_shadowing_builtins_with_parameters.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint require) pure public { 3 | require = 2; 4 | } 5 | } 6 | // ---- 7 | // Warning: (28-40): This declaration shadows a builtin symbol. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/563_event_without_emit_deprecated.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event e(); 3 | function f() public { 4 | e(); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (62-65): Event invocations have to be prefixed by "emit". 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/pragma_illegal.sol: -------------------------------------------------------------------------------- 1 | pragma ``; 2 | // ---- 3 | // ParserError: (7-8): Token incompatible with Solidity parser as part of pragma directive. 4 | // ParserError: (8-9): Token incompatible with Solidity parser as part of pragma directive. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/trailing_dot1.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 a = 2.2e10; 3 | uint256 b = .5E10; 4 | uint256 c = 4.e-2; 5 | } 6 | // ---- 7 | // TypeError: (70-73): Member "e" not found or not visible after argument-dependent lookup in int_const 4. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/rule/rule_fact.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct Person { 3 | int age; 4 | } 5 | 6 | rule "myRule" when { 7 | p: Person(true); 8 | q: Person(true, true); 9 | } then { 10 | } 11 | } 12 | // ---- 13 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/structs/recursion/struct_definition_directly_recursive.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | struct MyStructName { 3 | address addr; 4 | MyStructName x; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (20-93): Recursive struct definition. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/address_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant a = address(0); 3 | address payable constant b = address(0); 4 | function f() public pure returns (address, address) { 5 | return (a,b); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/address/contract_payable_fallback_to_payable_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view { 3 | address payable a = address(this); 4 | a; 5 | } 6 | function() external payable { 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/disambiguator/variables.yul: -------------------------------------------------------------------------------- 1 | // yul 2 | { { let a:u256 } { let a:u256 } } 3 | // ---- 4 | // disambiguator 5 | // { 6 | // { 7 | // let a:u256 8 | // } 9 | // { 10 | // let a_1:u256 11 | // } 12 | // } 13 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/unusedPruner/multi_declare.yul: -------------------------------------------------------------------------------- 1 | { 2 | function f() -> x, y { } 3 | let a, b := f() 4 | } 5 | // ---- 6 | // unusedPruner 7 | // { 8 | // function f() -> x, y 9 | // { 10 | // } 11 | // let a, b := f() 12 | // } 13 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_for.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { require(x); for (;x;) {} } 6 | } 7 | // ---- 8 | // Warning: (98-99): For loop condition is always true. 9 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/special/msg_sig.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f() public payable { 6 | assert(msg.sig == 0x00000000); 7 | } 8 | } 9 | // ---- 10 | // Warning: (79-108): Assertion violation happens here 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/no_array_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint data; 3 | function test() public { 4 | data.pop(); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (63-71): Member "pop" not found or not visible after argument-dependent lookup in uint256. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/function_type_pure_nonpayable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function h() pure external { 3 | } 4 | function f() view external returns (bytes4) { 5 | function () external g = this.h; 6 | return g.selector; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/function_type_pure_view.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function h() pure external { 3 | } 4 | function f() view external returns (bytes4) { 5 | function () view external g = this.h; 6 | return g.selector; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/not_allowed_conversion_to_int_array_pointer1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] a; 3 | uint[] b; 4 | function f() public view { 5 | uint[] storage c = a; 6 | uint[] storage d = b; 7 | d = uint[](c); 8 | } 9 | } 10 | // ---- 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/conversion/not_allowed_conversion_to_int_array_pointer2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] a; 3 | uint[] b; 4 | function f() public view { 5 | uint[] storage c = a; 6 | uint[] memory d = b; 7 | d = uint[](c); 8 | } 9 | } 10 | // ---- 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/function_type_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function f(function(uint) external returns (uint) g) public returns (function(uint) external returns (uint)) { 4 | x = 2; 5 | return g; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/private_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | function(uint) private returns (uint) x; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (47-86): Invalid visibility, can only be "external" or "internal". 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/functionTypes/public_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | function(uint) public returns (uint) x; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (47-85): Invalid visibility, can only be "external" or "internal". 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/modifiers/function_modifier_invocation_local_variables.sol: -------------------------------------------------------------------------------- 1 | contract B { 2 | function f() mod(x) pure public { uint x = 7; } 3 | modifier mod(uint a) { if (a > 0) _; } 4 | } 5 | // ---- 6 | // DeclarationError: (34-35): Undeclared identifier. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/088_double_event_declaration_ignores_anonymous.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint i); 3 | event A(uint i) anonymous; 4 | } 5 | // ---- 6 | // DeclarationError: (20-36): Event with same name and arguments defined twice. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/089_double_event_declaration_ignores_indexed.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint i); 3 | event A(uint indexed i); 4 | } 5 | // ---- 6 | // DeclarationError: (20-36): Event with same name and arguments defined twice. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/135_private_visibility.sol: -------------------------------------------------------------------------------- 1 | contract base { 2 | function f() private {} 3 | } 4 | contract derived is base { 5 | function g() public { f(); } 6 | } 7 | // ---- 8 | // DeclarationError: (99-100): Undeclared identifier. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/202_bytes_reference_compare_operators.sol: -------------------------------------------------------------------------------- 1 | contract test { bytes a; bytes b; function() external { a == b; } } 2 | // ---- 3 | // TypeError: (56-62): Operator == not compatible with types bytes storage ref and bytes storage ref 4 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/206_storage_location_local_variables.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] m_x; 3 | function f() public view { 4 | uint[] storage x = m_x; 5 | uint[] memory y; 6 | x;y; 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/280_continue_not_in_loop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | if (true) 4 | continue; 5 | } 6 | } 7 | // ---- 8 | // SyntaxError: (69-77): "continue" has to be in a "for" or "while" loop. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/350_unused_return_value_delegatecall.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | address(0x12).delegatecall("abc"); 4 | } 5 | } 6 | // ---- 7 | // Warning: (50-83): Return value of low-level calls not used. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/371_shift_constant_right_excessive_rvalue.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public a = 0x42 >> 0x100000000; 3 | } 4 | // ---- 5 | // TypeError: (33-52): Operator >> not compatible with types int_const 66 and int_const 4294967296 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/426_throw_is_deprecated.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | throw; 4 | } 5 | } 6 | // ---- 7 | // SyntaxError: (52-57): "throw" is deprecated in favour of "revert()", "require()" and "assert()". 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/428_bare_revert.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint x) pure public { 3 | if (x > 7) 4 | revert; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (81-87): No matching declaration found after variable lookup. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/433_pure_statement_in_for_loop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | for (uint x = 0; x < 10; true) 4 | x++; 5 | } 6 | } 7 | // ---- 8 | // Warning: (77-81): Statement has no effect. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/451_shadowing_builtins_with_variables.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint msg; 4 | msg; 5 | } 6 | } 7 | // ---- 8 | // Warning: (52-60): This declaration shadows a builtin symbol. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/572_function_type_undeclared_type_multi_nested.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function a(function(function(function(Nested)))) external pure {} 3 | } 4 | // ---- 5 | // DeclarationError: (55-61): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/local_const_variable.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function localConst() returns (uint ret) 3 | { 4 | uint constant local = 4; 5 | return local; 6 | } 7 | } 8 | // ---- 9 | // ParserError: (67-75): Expected ';' but got 'constant' 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_for_decl_in_body.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | for (;; y++){ 4 | uint y = 3; 5 | } 6 | } 7 | } 8 | // ---- 9 | // DeclarationError: (63-64): Undeclared identifier. 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/argument_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint) storage) public pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError: (28-57): Data location must be "memory" for parameter in function, but "storage" was given. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/mapping/library_return_private.sol: -------------------------------------------------------------------------------- 1 | library L 2 | { 3 | function f(mapping(uint => uint) storage a, mapping(uint => uint) storage b, bool c) private pure returns(mapping(uint => uint) storage) { 4 | return c ? a : b; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/rational_number_exp_limit_fine.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() public pure { 3 | int a; 4 | a = 0 ** 1E1233; 5 | a = 1 ** 1E1233; 6 | a = -1 ** 1E1233; 7 | a = 0E123456789; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/types/uint256_to_bytes1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns(bytes1) { 3 | return bytes1(uint256(0)); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (75-93): Explicit type conversion not allowed from "uint256" to "bytes1". 8 | -------------------------------------------------------------------------------- /test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr.yul: -------------------------------------------------------------------------------- 1 | { 2 | let a := mload(1) 3 | let b := mload(1) 4 | } 5 | // ---- 6 | // commonSubexpressionEliminator 7 | // { 8 | // let a := mload(1) 9 | // let b := mload(1) 10 | // } 11 | -------------------------------------------------------------------------------- /test/libsolidity/smtCheckerTests/functions/functions_trivial_condition_while.sol: -------------------------------------------------------------------------------- 1 | pragma experimental SMTChecker; 2 | 3 | contract C 4 | { 5 | function f(bool x) public pure { require(x); while (x) {} } 6 | } 7 | // ---- 8 | // Warning: (99-100): While loop condition is always true. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/array/length/cyclic_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = LEN; 3 | function f() public { 4 | uint[LEN] a; 5 | } 6 | } 7 | // ---- 8 | // TypeError: (37-40): Cyclic constant definition (or maximum recursion depth exhausted). 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/dataLocations/publicFunction/public_function_parameters_no_data_location.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function h(uint[]) public pure {} 3 | } 4 | // ---- 5 | // TypeError: (28-34): Data location must be "memory" for parameter in function, but none was given. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/inheritance/disallow_modifier_style_without_parentheses.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() public { } } 2 | contract B is A { constructor() A public { } } 3 | // ---- 4 | // DeclarationError: (72-73): Modifier-style base constructor call without arguments. 5 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/078_fallback_function_twice.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function() external { x = 2; } 4 | function() external { x = 3; } 5 | } 6 | // ---- 7 | // DeclarationError: (64-94): Only one fallback function is allowed. 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/137_external_visibility.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() external {} 3 | function g() public { f(); } 4 | } 5 | // ---- 6 | // DeclarationError: (68-69): Undeclared identifier. "f" is not (or not yet) visible at this point. 7 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/159_storage_variable_initialization_with_incorrect_type_string.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint a = "abc"; 3 | } 4 | // ---- 5 | // TypeError: (26-31): Type literal_string "abc" is not implicitly convertible to expected type uint256. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/331_rational_as_exponent_half.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | 2 ** (1/2); 4 | } 5 | } 6 | // ---- 7 | // TypeError: (50-60): Operator ** not compatible with types int_const 2 and rational_const 1 / 2 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/339_rational_bitor_binary_operation.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public { 3 | fixed(1.5) | 3; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (50-64): Operator | not compatible with types fixed128x18 and int_const 3 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/351_callcode_deprecated.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | address(0x12).callcode; 4 | } 5 | } 6 | // ---- 7 | // TypeError: (55-77): "callcode" has been deprecated in favour of "delegatecall". 8 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/531_tuple_invalid_literal_too_large_unassigned.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint x; 4 | (x, ) = (1, 1E111); 5 | } 6 | } 7 | // ---- 8 | // TypeError: (80-85): Invalid rational number. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/nameAndTypeResolution/539_array_length_invalid_expression_scientific_literal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1.111111E1111111111111] ids; 3 | } 4 | // ---- 5 | // TypeError: (22-44): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/parsing/constructor_super.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function x() pure internal {} 3 | } 4 | 5 | contract B is A { 6 | constructor() public { 7 | // used to trigger warning about using ``this`` in constructor 8 | super.x(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_activation.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | x = 3; 4 | uint x; 5 | } 6 | } 7 | // ---- 8 | // DeclarationError: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. 9 | -------------------------------------------------------------------------------- /test/libsolidity/syntaxTests/scoping/scoping_old.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { 3 | x = 4; 4 | uint256 x = 2; 5 | } 6 | } 7 | // ---- 8 | // DeclarationError: (55-56): Undeclared identifier. "x" is not (or not yet) visible at this point. 9 | --------------------------------------------------------------------------------