├── .dockerignore ├── cmake └── ViteUtils.cmake ├── test └── syntax │ ├── solidity │ ├── abiEncoder │ │ ├── select_v1.sol │ │ ├── select_v1_quoted_string.sol │ │ ├── select_v2_quoted_string.sol │ │ ├── selected_twice_v2.sol │ │ ├── invalid_pragma_value.sol │ │ ├── selected_twice.sol │ │ ├── conflicting_settings_reverse.sol │ │ ├── conflicting_settings.sol │ │ └── same_setting_twice.sol │ ├── parsing │ │ ├── empty_comment.sol │ │ ├── event.sol │ │ ├── event_arguments.sol │ │ ├── mapping.sol │ │ ├── smoke_test.sol │ │ ├── external_function.sol │ │ ├── fallback_function.sol │ │ ├── library_simple.sol │ │ ├── comment_end_with_double_star.sol │ │ ├── interface_basic.sol │ │ ├── function_type_state_variable.sol │ │ ├── multi_arrays.sol │ │ ├── address_payable_constant.sol │ │ ├── address_payable_library.sol │ │ ├── arrays_in_events.sol │ │ ├── import_empty.sol │ │ ├── modifier_arguments.sol │ │ ├── event_arguments_indexed.sol │ │ ├── assembly_evmasm_type.sol │ │ ├── function_type_as_storage_variable.sol │ │ ├── import_complex_without_from.sol │ │ ├── no_function_params.sol │ │ ├── address_in_struct.sol │ │ ├── empty_enum.sol │ │ ├── event_with_no_argument_list.sol │ │ ├── from_is_not_keyword.sol │ │ ├── import_simple.sol │ │ ├── import_complex_invalid_from.sol │ │ ├── import_invalid_token.sol │ │ ├── modifier.sol │ │ ├── trailing_dot3.sol │ │ ├── var_array.sol │ │ ├── array_range_no_start.sol │ │ ├── function_no_body.sol │ │ ├── constant_is_keyword.sol │ │ ├── external_variable.sol │ │ ├── import_complex.sol │ │ ├── malformed_enum_declaration.sol │ │ ├── new_invalid_type_name.sol │ │ ├── fixed_literal_with_double_radix.sol │ │ ├── mapping_nonelementary_key_1.sol │ │ ├── mapping_nonelementary_key_4.sol │ │ ├── missing_variable_name_in_declaration.sol │ │ ├── single_function_param.sol │ │ ├── empty_function.sol │ │ ├── location_specifiers_with_var.sol │ │ ├── modifier_without_semicolon.sol │ │ ├── new_address_payable.sol │ │ ├── struct_definition.sol │ │ ├── wrong_compiler_1.sol │ │ ├── address_public_payable_error.sol │ │ ├── emit_without_event.sol │ │ ├── location_specifiers_for_state_variables.sol │ │ ├── multiple_modifier_overrides.sol │ │ ├── payable_accessor.sol │ │ ├── scientific_notation.sol │ │ ├── tuples_without_commas.sol │ │ ├── arrays_in_storage.sol │ │ ├── constructor_public_public.sol │ │ ├── mapping_from_address_payable.sol │ │ ├── address_constant_payable.sol │ │ ├── constructor_internal_public.sol │ │ ├── constructor_public_internal.sol │ │ ├── function_type_as_parameter.sol │ │ ├── single_function_param_trailing_comma.sol │ │ ├── address_nonpayable.sol │ │ ├── constructor_internal_internal.sol │ │ ├── constructor_payable_payable.sol │ │ ├── assembly_invalid_type.sol │ │ ├── multiple_function_param_trailing_comma.sol │ │ ├── single_return_param_trailing_comma.sol │ │ ├── enum_valid_declaration.sol │ │ ├── literal_constants_with_ether_subdenominations_in_expressions.sol │ │ ├── location_specifiers_for_state_variables_multi.sol │ │ ├── mapping_in_struct.sol │ │ ├── mapping_to_mapping_in_struct.sol │ │ ├── payable_without_arguments.sol │ │ ├── trailing_dot2.sol │ │ ├── var_storage_var.sol │ │ ├── wrong_compiler_2.sol │ │ ├── address_function_arguments_and_returns.sol │ │ ├── single_event_arg_trailing_comma.sol │ │ ├── tuples_decl_without_rhs.sol │ │ ├── conditional_with_assignment.sol │ │ ├── function_normal_comments.sol │ │ ├── function_type_as_storage_variable_with_modifiers.sol │ │ ├── inline_array_declaration.sol │ │ ├── multiple_return_param_trailing_comma.sol │ │ ├── wrong_compiler_3.sol │ │ ├── address_payable_type_expression.sol │ │ ├── address_payable.sol │ │ ├── constant_state_modifier.sol │ │ ├── function_type_as_storage_variable_with_assignment.sol │ │ ├── multiple_event_arg_trailing_comma.sol │ │ ├── single_modifier_arg_trailing_comma.sol │ │ └── wrong_compiler_4.sol │ ├── abstract │ │ ├── contract.sol │ │ ├── library.sol │ │ ├── abstract_without_contract.sol │ │ ├── unimplemented_functions.sol │ │ ├── interface.sol │ │ ├── abstract_only.sol │ │ └── unimplemented_functions_inherited.sol │ ├── constructor │ ├── imports │ │ ├── smoke_test.sol │ │ ├── regular_import.sol │ │ ├── library_name_clash_with_contract.sol │ │ ├── name_clash_in_import_5.sol │ │ ├── circular_import.sol │ │ ├── relative_import_multiplex.sol │ │ ├── name_clash_in_import_contract_struct_5.sol │ │ ├── name_clash_in_import_struct_5.sol │ │ ├── name_clash_in_import_struct_contract_5.sol │ │ ├── import_is_transitive.sol │ │ ├── relative_import.sol │ │ ├── simple_alias.sol │ │ ├── name_clash_in_import_1.sol │ │ ├── name_clash_in_import_2.sol │ │ ├── name_clash_in_import_enum.sol │ │ ├── name_clash_in_import_4.sol │ │ ├── name_clash_in_import_3.sol │ │ └── name_clash_in_import_enum_contract.sol │ ├── nameAndTypeResolution │ │ ├── 414_interface.sol │ │ ├── 228_valid_library.sol │ │ ├── 417_interface_events.sol │ │ ├── 418_interface_inheritance.sol │ │ ├── 422_interface_enums.sol │ │ ├── 526_fallback_marked_external.sol │ │ ├── shadowsBuiltin │ │ │ ├── ignores_constructor.sol │ │ │ ├── ignores_struct.sol │ │ │ ├── global_scope.sol │ │ │ ├── events.sol │ │ │ ├── storage_variables.sol │ │ │ └── functions.sol │ │ ├── 191_negative_integers_to_signed_min.sol │ │ ├── 251_using_for_library.sol │ │ ├── 355_payable_external.sol │ │ ├── 074_fallback_function.sol │ │ ├── 104_empty_name_input_parameter.sol │ │ ├── 193_positive_integers_to_signed_out_of_bound_max.sol │ │ ├── 419_interface_structs.sol │ │ ├── 438_unused_unnamed_function_parameter.sol │ │ ├── 497_gasleft.sol │ │ ├── 106_empty_name_return_parameter.sol │ │ ├── 146_external_argument_assign.sol │ │ ├── 147_external_argument_increment.sol │ │ ├── 168_assignment_to_const_var_involving_conversion.sol │ │ ├── 169_assignment_to_const_var_involving_expression.sol │ │ ├── 170_assignment_to_const_var_involving_keccak.sol │ │ ├── 568_blockhash.sol │ │ ├── warnUnused │ │ │ ├── function_parameter.sol │ │ │ ├── return_parameter.sol │ │ │ ├── local.sol │ │ │ └── local_assignment.sol │ │ ├── 204_overwrite_memory_location_external.sol │ │ ├── 415_interface_functions.sol │ │ ├── 421_interface_function_parameters.sol │ │ ├── 441_unused_unnamed_return_parameter.sol │ │ ├── 461_event_parameter_cannot_shadow_state_variable.sol │ │ ├── 445_no_unused_warning_interface_arguments.sol │ │ ├── 400_does_not_warn_msg_value_in_library.sol │ │ ├── 442_named_return_parameter.sol │ │ ├── 057_legal_override_direct.sol │ │ ├── 174_address_is_constant.sol │ │ ├── 004_reference_to_later_declaration.sol │ │ ├── 053_hash_collision_in_interface.sol │ │ ├── 115_exp_warn_literal_base_3.sol │ │ ├── 398_does_not_warn_msg_value_in_payable_function.sol │ │ ├── 459_function_overload_is_not_shadowing.sol │ │ ├── 118_shift_warn_literal_base_3.sol │ │ ├── 353_callcode_not_deprecated_as_function.sol │ │ ├── 399_does_not_warn_msg_value_in_internal_function.sol │ │ ├── 226_inheriting_library.sol │ │ ├── 227_library_having_variables.sol │ │ ├── 420_interface_variables.sol │ │ ├── 431_bare_assert.sol │ │ ├── 446_no_unused_warning_abstract_arguments.sol │ │ ├── 058_legal_override_indirect.sol │ │ ├── 154_array_copy_with_different_types_conversion_possible.sol │ │ ├── 155_array_copy_with_different_types_static_dynamic.sol │ │ ├── 225_inheriting_from_library.sol │ │ ├── 443_named_return_parameter_with_explicit_return.sol │ │ ├── 444_unnamed_return_parameter_with_explicit_return.sol │ │ ├── 460_function_override_is_not_shadowing.sol │ │ ├── 487_function_types_selector_4.sol │ │ ├── 139_no_name_suggestion.sol │ │ ├── 175_uninitialized_const_variable.sol │ │ ├── 252_using_for_not_library.sol │ │ ├── 447_no_unused_warnings.sol │ │ ├── free_and_constant.sol │ │ ├── 157_array_of_undeclared_type.sol │ │ ├── 214_assignment_mem_storage_variable_directly.sol │ │ ├── 345_unused_return_value.sol │ │ ├── 423_using_interface.sol │ │ ├── 430_bare_selfdestruct.sol │ │ ├── 483_modifiers_access_storage_pointer.sol │ │ ├── 076_fallback_function_in_library.sol │ │ ├── 119_shift_warn_literal_base_4.sol │ │ ├── 298_invalid_fixed_types_0x7_mxn.sol │ │ ├── 354_payable_in_library.sol │ │ ├── 434_pure_statement_check_for_regular_for_loop.sol │ │ ├── 479_explicit_literal_to_memory_string_assignment.sol │ │ ├── 114_exp_warn_literal_base_2.sol │ │ ├── 117_shift_warn_literal_base_2.sol │ │ ├── 260_library_memory_struct.sol │ │ ├── 268_function_overload_array_type.sol │ │ ├── 401_does_not_warn_msg_value_in_modifier_following_non_payable_public_function.sol │ │ ├── 528_fallback_marked_private.sol │ │ ├── 529_fallback_marked_public.sol │ │ ├── 056_cyclic_inheritance.sol │ │ ├── 096_access_to_default_function_visibility.sol │ │ ├── 113_exp_warn_literal_base_1.sol │ │ ├── 116_shift_warn_literal_base_1.sol │ │ ├── 172_assignment_to_const_string_bytes.sol │ │ ├── 198_integer_boolean_not.sol │ │ ├── 300_invalid_fixed_types_7x8_mxn.sol │ │ ├── 527_fallback_marked_internal.sol │ │ ├── 356_payable_internal.sol │ │ ├── 357_payable_private.sol │ │ ├── 425_interface_implement_public_contract.sol │ │ ├── 044_returning_multi_dimensional_arrays_new_abi.sol │ │ ├── 188_string_index.sol │ │ ├── 245_tuples_empty_components.sol │ │ ├── shift_warn_literal_large_shift_amount.sol │ │ ├── 061_missing_base_constructor_arguments.sol │ │ ├── 062_base_constructor_arguments_override.sol │ │ ├── 079_fallback_function_inheritance.sol │ │ ├── 148_external_argument_delete.sol │ │ ├── 366_invalid_array_as_statement.sol │ │ ├── 429_revert_with_reason.sol │ │ ├── 470_specified_storage_no_warn.sol │ │ ├── 015_balance_invalid.sol │ │ ├── 110_no_overflow_with_large_literal.sol │ │ ├── 216_function_argument_storage_to_mem.sol │ │ ├── 402_assignment_to_constant.sol │ │ ├── 416_interface_function_bodies.sol │ │ ├── 501_gasleft_shadowing_2.sol │ │ ├── 512_library_function_without_implementation_internal.sol │ │ ├── 513_library_function_without_implementation_private.sol │ │ ├── 533_tuple_invalid_literal_too_large_exp.sol │ │ ├── 570_function_type_undeclared_type.sol │ │ ├── typeChecking │ │ │ └── function_call.sol │ │ ├── 047_returning_arrays_in_structs_new_abi.sol │ │ ├── 054_inheritance_basic.sol │ │ ├── 133_enum_duplicate_values.sol │ │ └── 171_assignment_to_const_array_vars.sol │ ├── immutable │ │ ├── immutable_basic.sol │ │ ├── function_initialization.sol │ │ ├── initialized_after_ctor.sol │ │ ├── long_name.sol │ │ ├── non-value_type.sol │ │ ├── reading_after_initialization.sol │ │ ├── unrelated_reading.sol │ │ ├── uninitialized.sol │ │ ├── as_function_param.sol │ │ └── external_function_pointer.sol │ ├── types │ │ ├── event_with_rational_size_array.sol │ │ ├── mapping │ │ │ ├── mapping_dynamic_key.sol │ │ │ ├── mapping_dynamic_key_public.sol │ │ │ ├── library_argument_internal.sol │ │ │ ├── library_argument_private.sol │ │ │ ├── argument_internal.sol │ │ │ ├── argument_private.sol │ │ │ ├── library_array_argument_private.sol │ │ │ ├── array_argument_private.sol │ │ │ ├── library_argument_public.sol │ │ │ ├── library_array_argument_internal.sol │ │ │ ├── array_argument_internal.sol │ │ │ ├── library_argument_external.sol │ │ │ ├── library_array_argument_public.sol │ │ │ ├── library_array_argument_external.sol │ │ │ ├── function_type_argument_internal.sol │ │ │ ├── library_storage_parameter_with_mapping.sol │ │ │ ├── function_type_return_internal.sol │ │ │ ├── enum_mapping.sol │ │ │ ├── library_nested_storage.sol │ │ │ └── library_storage_parameter_with_nested_mapping.sol │ │ ├── library_internal_call.sol │ │ ├── bytes0.sol │ │ ├── bytes33.sol │ │ ├── address │ │ │ ├── address_payable_selfdestruct.sol │ │ │ ├── address_to_contract.sol │ │ │ ├── contract_to_address.sol │ │ │ ├── payable_address_to_address.sol │ │ │ ├── codehash.sol │ │ │ ├── address_to_contract_receive.sol │ │ │ ├── payable_to_contract_receive.sol │ │ │ └── address_abi_decode.sol │ │ ├── bytes256.sol │ │ ├── index_access_for_bytes.sol │ │ ├── bytesNN_bitnot.sol │ │ ├── rational_negative_numerator_negative_exp.sol │ │ ├── call_unimplemented_internal_function.sol │ │ ├── contract_to_base.sol │ │ ├── library_to_address.sol │ │ ├── function_call_fail.sol │ │ ├── var_empty_decl_3.sol │ │ ├── byte.sol │ │ ├── global_struct_recursive.sol │ │ ├── hex_literal_bitnot.sol │ │ ├── no_singleton_tuple.sol │ │ ├── contract_to_base_base.sol │ │ ├── function_call_fail2.sol │ │ ├── empty_tuple_event.sol │ │ └── var_empty_decl_1.sol │ ├── largeTypes │ │ ├── large_storage_array_fine.sol │ │ └── large_storage_arrays_combined.sol │ ├── constants │ │ ├── constant_natspec.sol │ │ ├── constant_unassigned.sol │ │ ├── constant_virtual.sol │ │ ├── file_level_memory.sol │ │ ├── non_constant.sol │ │ ├── constant_override.sol │ │ ├── constant_with_visibility.sol │ │ ├── file_level_memory_inverted.sol │ │ ├── constant_with_visibility_inverted.sol │ │ ├── mapping_constant.sol │ │ ├── redefinition_public_constant.sol │ │ ├── struct_constant.sol │ │ ├── cyclic_dependency_1.sol │ │ ├── constant_natspec_user.sol │ │ └── cyclic_dependency_4.sol │ ├── events │ │ ├── event_nested_array_2.sol │ │ ├── events_with_same_name.sol │ │ ├── overloading_in_contract.sol │ │ ├── events_with_same_name_different_types.sol │ │ ├── event_array_v2.sol │ │ ├── inheritance_adds_parameter.sol │ │ ├── event_emit_simple.sol │ │ ├── event_nested_array_v2.sol │ │ ├── events_with_same_name_unnamed_arguments.sol │ │ ├── multiple_inheritance.sol │ │ ├── event_array_indexed_v2.sol │ │ ├── event_nested_array_indexed_v2.sol │ │ ├── event_struct_v2.sol │ │ ├── multiple_events_argument_clash.sol │ │ ├── anonymous_event_four_indexed.sol │ │ ├── event_function_type_indexed.sol │ │ ├── event_struct_indexed_v2.sol │ │ ├── event_call.sol │ │ ├── event.sol │ │ ├── event_emit_complex.sol │ │ ├── event_inheritance.sol │ │ ├── double_event_declaration.sol │ │ ├── event_emit_foreign_class.sol │ │ ├── event_too_many_indexed.sol │ │ └── event_without_emit_deprecated.sol │ ├── pragma │ │ ├── invalid_pragma.sol │ │ ├── unknown_pragma.sol │ │ ├── unterminated_pragma.sol │ │ ├── experimental_pragma_empty.sol │ │ ├── version_check.sol │ │ ├── experimental_empty_string_literal.sol │ │ ├── experimental_multiple_same_line.sol │ │ ├── experimental_unknown_number_literal.sol │ │ ├── broken_version_1.sol │ │ ├── empty_version.sol │ │ ├── experimental_pragma_unknown_string_literal.sol │ │ ├── experimental_unknown_quoted_string_literal.sol │ │ ├── broken_version_2.sol │ │ ├── broken_version_4.sol │ │ ├── broken_version_5.sol │ │ ├── experimental_test_warning.sol │ │ └── unterminated_version.sol │ ├── freeFunctions │ │ ├── free_storage.sol │ │ ├── free_function_without_body.sol │ │ ├── free_payable.sol │ │ ├── free_different_integer_types.sol │ │ ├── free_override.sol │ │ ├── free_virtual.sol │ │ ├── struct_after_function.sol │ │ ├── free_function_modifier.sol │ │ ├── function_same_name_as_contract.sol │ │ ├── free_functions.sol │ │ ├── free_receive.sol │ │ ├── free_fallback.sol │ │ ├── free_constructor.sol │ │ ├── this_in_free_function.sol │ │ └── super_in_free_function.sol │ ├── license │ │ ├── license_whitespace_after_colon.sol │ │ ├── license_whitespace_before_spdx.sol │ │ ├── license_missing.sol │ │ ├── license_hidden_unicode.sol │ │ ├── license_cr_endings.sol │ │ ├── license_bottom.sol │ │ ├── license_natspec.sol │ │ ├── license_missing_colon.sol │ │ ├── license_multiline.sol │ │ ├── license_no_whitespace.sol │ │ ├── license_whitespace_trailing.sol │ │ ├── license_crlf_endings.sol │ │ ├── license_natspec_multiline.sol │ │ ├── license_no_whitespace_multiline.sol │ │ └── license_nonempty_line.sol │ ├── string │ │ ├── large_utf8_codepoint.sol │ │ ├── invalid_utf8_sequence.sol │ │ ├── invalid_utf8_in_bytes.sol │ │ ├── string_unicode.sol │ │ ├── string_unterminated_no_new_line.sol │ │ └── string_escapes.sol │ ├── viewPureChecker │ │ ├── suggest_pure.sol │ │ ├── creation_no_restrict_warning.sol │ │ ├── constant.sol │ │ ├── immutable.sol │ │ ├── interface.sol │ │ ├── array │ │ │ └── access_to_array_push.sol │ │ ├── callvalue_payable_assembly_function.sol │ │ ├── overriding_no_restrict_warning.sol │ │ ├── assembly_constantinople.sol │ │ └── suggest_view.sol │ ├── visibility │ │ ├── interface │ │ │ ├── function_external.sol │ │ │ ├── function_private.sol │ │ │ ├── function_public.sol │ │ │ └── function_internal.sol │ │ └── function_no_visibility.sol │ ├── literals │ │ ├── hex_string_underscores_valid.sol │ │ ├── hex_string_leading_underscore.sol │ │ ├── hex_string_duplicate_underscore.sol │ │ ├── hex_string_misaligned_underscore.sol │ │ └── hex_string_trailing_underscore.sol │ ├── metaTypes │ │ ├── name_constant.sol │ │ ├── name.sol │ │ ├── typeNotRegularIdentifierContractName.sol │ │ ├── typeNotRegularIdentifierStateVariable.sol │ │ ├── typeNotRegularIdentifierFunction.sol │ │ ├── typeNotRegularIdentifierParameter.sol │ │ ├── typeNotRegularIdentifierVariable.sol │ │ └── codeAccessIsConstant.sol │ ├── array │ │ ├── length │ │ │ ├── constant_var.sol │ │ │ ├── can_be_constant_in_struct.sol │ │ │ ├── can_be_recursive_constant.sol │ │ │ ├── tuples.sol │ │ │ ├── inline_array.sol │ │ │ ├── invalid_expression_5.sol │ │ │ ├── too_large.sol │ │ │ ├── bytes32_too_large.sol │ │ │ ├── invalid_expression_1.sol │ │ │ ├── invalid_expression_2.sol │ │ │ ├── invalid_expression_3.sol │ │ │ ├── parameter_too_large.sol │ │ │ ├── can_be_constant_in_function.sol │ │ │ ├── not_convertible_to_integer.sol │ │ │ ├── uint_too_large_multidim.sol │ │ │ ├── bytes32_too_large_multidim.sol │ │ │ ├── invalid_expression_4.sol │ │ │ └── cannot_be_function.sol │ │ ├── slice │ │ │ ├── bytes_calldata.sol │ │ │ ├── calldata_dynamic.sol │ │ │ ├── assign_to_storage.sol │ │ │ ├── calldata_dynamic_forward.sol │ │ │ ├── calldata_dynamic_encode.sol │ │ │ ├── calldata_dynamic_convert_to_memory.sol │ │ │ ├── slice_literal.sol │ │ │ └── slice_string.sol │ │ ├── array_pop.sol │ │ ├── bytes_pop.sol │ │ ├── calldata.sol │ │ ├── calldata_dynamic.sol │ │ ├── calldata_multi.sol │ │ ├── calldata_multi_dynamic.sol │ │ ├── pop │ │ │ └── storage_with_mapping_pop.sol │ │ ├── invalid │ │ │ └── library_array.sol │ │ ├── library_array.sol │ │ └── calldata_assign.sol │ ├── fallback │ │ ├── payable_fallback_without_receive_empty.sol │ │ ├── returns.sol │ │ ├── payable_fallback_without_receive_only_internal.sol │ │ ├── payable_fallback_with_inherited_receive.sol │ │ ├── pure_modifier.sol │ │ └── view_modifier.sol │ ├── getter │ │ ├── simple_struct.sol │ │ └── complex_struct.sol │ ├── inheritance │ │ ├── shadowing_private_base_state_vars.sol │ │ ├── allow_empty_duplicated_super_constructor_call.sol │ │ ├── base_not_contract.sol │ │ ├── interface │ │ │ ├── single_parent.sol │ │ │ └── contract_base.sol │ │ ├── override │ │ │ ├── add_view.sol │ │ │ ├── function_state_variable.sol │ │ │ ├── override_shared_base_simple.sol │ │ │ ├── override_library.sol │ │ │ ├── external_turns_public_no_params.sol │ │ │ ├── public_var_same_name_but_different_args.sol │ │ │ └── public_vars_wrong_override.sol │ │ ├── virtual │ │ │ ├── simple.sol │ │ │ ├── library_err.sol │ │ │ └── modifier_virtual_err.sol │ │ ├── base_arguments_no_parentheses.sol │ │ ├── fallback_receive │ │ │ ├── fallback_with_override.sol │ │ │ ├── receive_with_override.sol │ │ │ └── fallback_with_override_intermediate.sol │ │ ├── interface_virtual_warning.sol │ │ ├── shadowing_base_state_vars.sol │ │ ├── unimplemented_without_virtual.sol │ │ ├── reference_non_base_ctor.sol │ │ └── duplicated_constructor_call │ │ │ └── base.sol │ ├── natspec │ │ ├── docstring_double_empty.sol │ │ ├── docstring_state_variable.sol │ │ ├── docstring_empty_tag.sol │ │ ├── docstring_empty_description.sol │ │ └── docstring_named_return_parameter.sol │ ├── duplicate_contract.sol │ ├── enums │ │ ├── global_enum.sol │ │ ├── global_enum_name_clash.sol │ │ └── global_enum_contract_name_clash.sol │ ├── empty_struct.sol │ ├── structs │ │ ├── recursion │ │ │ ├── struct_definition_not_really_recursive.sol │ │ │ ├── struct_definition_not_really_recursive_array.sol │ │ │ ├── recursive_struct_nested_mapping_storage.sol │ │ │ ├── struct_definition_directly_recursive_dynamic_array.sol │ │ │ └── struct_definition_recursion_via_mapping.sol │ │ ├── global_struct.sol │ │ ├── calldata.sol │ │ ├── calldata_dynamic.sol │ │ ├── contract_global_struct_name_clash.sol │ │ ├── global_struct_contract_name_clash.sol │ │ ├── global_structs_name_clash.sol │ │ ├── address_member_declaration.sol │ │ ├── array_calldata.sol │ │ └── member_type_eq_name.sol │ ├── tupleAssignments │ │ ├── tuple_in_tuple_short.sol │ │ └── nowarn_swap_memory.sol │ ├── conversion │ │ ├── conversion_to_bytes.sol │ │ ├── implicit_conversion_from_storage_array_ref.sol │ │ ├── convert_to_super_empty.sol │ │ ├── convert_to_super_nonempty.sol │ │ ├── allowed_conversion_to_bytes_array.sol │ │ └── allowed_conversion_to_string.sol │ ├── modifiers │ │ ├── legal_modifier_override.sol │ │ ├── cross_contract_base.sol │ │ ├── function_modifier_double_invocation.sol │ │ ├── modifier_without_underscore.sol │ │ └── constructor_as_modifier.sol │ ├── tryCatch │ │ ├── simple_catch.sol │ │ └── no_catch.sol │ ├── functionTypes │ │ ├── function_type.sol │ │ ├── external_function_type_to_address.sol │ │ ├── function_type_struct.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 │ │ ├── delete_external_function_type_invalid.sol │ │ ├── payable_internal_function_type.sol │ │ ├── external_function_type_taking_internal.sol │ │ └── function_type_return_parameters_with_names.sol │ ├── scoping │ │ ├── scoping_for2.sol │ │ ├── scoping_for.sol │ │ ├── function_state_variable_conflict.sol │ │ ├── name_shadowing2.sol │ │ └── state_variable_function_conflict.sol │ ├── controlFlow │ │ ├── unreachableCode │ │ │ ├── comment_fine.sol │ │ │ ├── double_revert.sol │ │ │ ├── revert.sol │ │ │ └── double_return.sol │ │ ├── mappingReturn │ │ │ ├── named_fine.sol │ │ │ └── unnamed_fine.sol │ │ └── storageReturn │ │ │ └── unimplemented_internal.sol │ ├── emit │ │ ├── emit_empty.sol │ │ └── emit_non_event.sol │ ├── literal_comparisons.sol │ ├── dataLocations │ │ ├── libraryExternalFunction │ │ │ ├── function_argument_location_specifier_test_external_storage.sol │ │ │ ├── function_argument_location_specifier_test_external_memory.sol │ │ │ └── function_argument_location_specifier_test_external_calldata.sol │ │ ├── publicFunction │ │ │ └── function_argument_location_specifier_test_public_memory.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 │ │ │ └── function_argument_location_specifier_test_internal_calldata.sol │ │ ├── externalFunction │ │ │ └── function_argument_location_specifier_test_external_calldata.sol │ │ └── data_location_in_function_type.sol │ ├── denominations │ │ ├── gwei_as_identifier.sol │ │ ├── deprecated_year.sol │ │ ├── szabo_invalid.sol │ │ ├── finney_invalid.sol │ │ └── szabo_finney_identifiers.sol │ ├── specialFunctions │ │ └── abidecode │ │ │ ├── contract_array.sol │ │ │ ├── abi_decode_single_return.sol │ │ │ ├── abi_decode_singletontuple.sol │ │ │ ├── abi_decode_simple.sol │ │ │ └── abi_decode_empty.sol │ ├── unterminatedBlocks │ │ ├── one_dot.sol │ │ └── zero_dot.sol │ ├── indexing │ │ ├── index_range_access_assert.sol │ │ ├── array_out_of_bounds_index.sol │ │ ├── array_without_index.sol │ │ ├── fixedbytes_out_of_bounds_index.sol │ │ ├── fixedbytes_without_index.sol │ │ ├── function_type.sol │ │ └── function_type_without_index.sol │ ├── literalOperations │ │ ├── exponent_fine.sol │ │ ├── mod_zero.sol │ │ ├── division_by_zero.sol │ │ ├── mod_zero_complex.sol │ │ └── division_by_zero_complex.sol │ ├── lvalues │ │ ├── external_reference_argument.sol │ │ └── calldata_index_access.sol │ ├── unexpected.sol │ ├── inlineAssembly │ │ ├── function_definition.sol │ │ ├── assignment_from_library.sol │ │ ├── const_forward_reference.sol │ │ ├── leave.sol │ │ ├── no_unused_variable_warning.sol │ │ ├── string_literal_switch_case.yul │ │ ├── constant_computation.sol │ │ ├── assignment_from_contract.sol │ │ ├── function_call_not_found.sol │ │ └── invalid │ │ │ └── constant_access.sol │ ├── receiveEther │ │ ├── arguments.sol │ │ ├── msg_data_in_receive.sol │ │ ├── pure_modifier.sol │ │ └── view_modifier.sol │ ├── double_stateVariable_declaration.sol │ ├── multiSource │ │ └── import_not_found.sol │ ├── unchecked │ │ ├── unchecked_function_body.sol │ │ └── unchecked_modifier.sol │ ├── constantEvaluator │ │ └── unary_fine.sol │ ├── memberLookup │ │ ├── msg_value_modifier_payable.sol │ │ └── internal_function_type.sol │ ├── functionCalls │ │ ├── int_not_callable.sol │ │ ├── lowlevel_call_options.sol │ │ └── new_library.sol │ ├── globalFunctions │ │ ├── now_deprecate.sol │ │ ├── now_override.sol │ │ └── sha3_no_call.sol │ ├── comments │ │ └── unicode_direction_in_source_2.sol │ ├── bound │ │ ├── bound_call.sol │ │ └── bound_no_call.sol │ ├── super │ │ ├── super_in_function.sol │ │ └── super_in_library.sol │ └── multiVariableDeclaration │ │ └── oneElementTuple.sol │ ├── soliditypp │ ├── magic │ │ ├── height.solpp │ │ ├── fromhash.solpp │ │ ├── prevhash.solpp │ │ ├── account_height.solpp │ │ ├── blake2b.solpp │ │ ├── amount.solpp │ │ ├── random64.solpp │ │ ├── token_id.solpp │ │ ├── balance.solpp │ │ ├── blake2b_literal.solpp │ │ └── next_random.solpp │ ├── pragma │ │ ├── version_check.solpp │ │ ├── low_version.solpp │ │ └── different_version.solpp │ ├── interface │ │ └── interface.solpp │ └── function │ │ ├── interface_function.solpp │ │ └── external_function.solpp │ ├── cross_language │ └── soliditypp_syntax_in_solidity_source.sol │ └── smoke_test.sol └── .gitmodules /.dockerignore: -------------------------------------------------------------------------------- 1 | build/* 2 | -------------------------------------------------------------------------------- /cmake/ViteUtils.cmake: -------------------------------------------------------------------------------- 1 | # define util functions here -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/select_v1.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v1; -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/empty_comment.sol: -------------------------------------------------------------------------------- 1 | // 2 | contract test 3 | {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/select_v1_quoted_string.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder "v1"; -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/select_v2_quoted_string.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder "v2"; -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/event.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/contract.sol: -------------------------------------------------------------------------------- 1 | abstract contract A { constructor() {} } 2 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructor.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() {} } 2 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/smoke_test.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract C {} 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/414_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | } 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/immutable_basic.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable x = 0; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/228_valid_library.sol: -------------------------------------------------------------------------------- 1 | library Lib { uint constant x = 9; } 2 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/event_arguments.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint a, bytes32 s); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/event_with_rational_size_array.sol: -------------------------------------------------------------------------------- 1 | contract a { event b(uint[(1 / 1)]); } 2 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "solidity"] 2 | path = solidity 3 | url = https://github.com/ethereum/solidity.git 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/selected_twice_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | pragma experimental ABIEncoderV2; -------------------------------------------------------------------------------- /test/syntax/solidity/largeTypes/large_storage_array_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[2**64 - 1] x; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/417_interface_events.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | event E(); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/mapping.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | mapping(address => bytes32) names; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/smoke_test.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVariable1; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_natspec.sol: -------------------------------------------------------------------------------- 1 | /// @dev Documentation 2 | uint constant x = 8; 3 | // ---- 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_nested_array_2.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event E(uint[2][]); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/external_function.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function x() external {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/fallback_function.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | fallback() external { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/library_simple.sol: -------------------------------------------------------------------------------- 1 | library Lib { 2 | function f() public { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/mapping_dynamic_key.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string => uint) data; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/comment_end_with_double_star.sol: -------------------------------------------------------------------------------- 1 | contract C1 { 2 | /** 3 | **/ 4 | } 5 | contract C2 {} 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/interface_basic.sol: -------------------------------------------------------------------------------- 1 | interface Interface { 2 | function f() external; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/invalid_pragma.sol: -------------------------------------------------------------------------------- 1 | pragma 0; 2 | // ---- 3 | // SyntaxError 5226: (0-9): Invalid pragma "0" 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/events_with_same_name.sol: -------------------------------------------------------------------------------- 1 | contract TestIt { 2 | event A(); 3 | event A(uint i); 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/overloading_in_contract.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | event X(); 3 | event X(uint); 4 | } 5 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_storage.sol: -------------------------------------------------------------------------------- 1 | struct S { uint x; } 2 | function fun(S storage) { 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_whitespace_after_colon.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | contract C {} 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_whitespace_before_spdx.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | contract C {} 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/418_interface_inheritance.sol: -------------------------------------------------------------------------------- 1 | interface A { 2 | } 3 | interface I is A { 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/422_interface_enums.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | enum A { B, C } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/function_type_state_variable.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() x; 3 | function() y = x; 4 | } -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/multi_arrays.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(uint => mapping(uint => int8)[8][][9])[] x; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/string/large_utf8_codepoint.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string s = "\xf0\x9f\xa6\x84"; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/suggest_pure.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function g() view public { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/visibility/interface/function_external.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/literals/hex_string_underscores_valid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes constant c = hex"12_3456_789012"; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/name_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string public constant name = type(C).name; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/526_fallback_marked_external.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback () external { } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/ignores_constructor.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/address_payable_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address payable constant a = payable(0); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/address_payable_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | } 3 | contract C { 4 | using L for address payable; 5 | } -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/arrays_in_events.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint[10] a, bytes7[8] indexed b, c[3] x); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/constant_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant LEN = 10; 3 | uint[LEN] ids; 4 | } 5 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructor_storage_abstract.sol: -------------------------------------------------------------------------------- 1 | abstract contract A { 2 | constructor(uint[] storage a) {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/fallback/payable_fallback_without_receive_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback() external payable { } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/191_negative_integers_to_signed_min.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public i = -128; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/251_using_for_library.sol: -------------------------------------------------------------------------------- 1 | library D { } 2 | contract C { 3 | using D for uint; 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/355_payable_external.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable external {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/import_empty.sol: -------------------------------------------------------------------------------- 1 | import ""; 2 | // ---- 3 | // ParserError 6326: (9-10): Import path cannot be empty. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/modifier_arguments.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod(address a) { if (msg.sender == a) _; } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/library.sol: -------------------------------------------------------------------------------- 1 | abstract library A { } 2 | // ---- 3 | // TypeError 9571: (0-22): Libraries cannot be abstract. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/events_with_same_name_different_types.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint); 3 | event A(bytes); 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/regular_import.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract C {} 3 | ==== Source: b ==== 4 | import "a"; contract D is C {} -------------------------------------------------------------------------------- /test/syntax/solidity/largeTypes/large_storage_arrays_combined.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[200][200][2**30][][2**30] x; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/event_arguments_indexed.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e(uint a, bytes32 indexed s, bool indexed b); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/mapping_dynamic_key_public.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string => uint) public data; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_array_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | event E(uint[]); 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/inheritance_adds_parameter.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | event X(); 3 | } 4 | contract B is A { 5 | event X(uint); 6 | } -------------------------------------------------------------------------------- /test/syntax/solidity/imports/library_name_clash_with_contract.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | library A {} 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/074_fallback_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | fallback() external { x = 2; } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/assembly_evmasm_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly "evmasm" {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_unassigned.sol: -------------------------------------------------------------------------------- 1 | uint constant x; 2 | // ---- 3 | // TypeError 4266: (0-15): Uninitialized "constant" variable. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructer_internal_function_abstract.sol: -------------------------------------------------------------------------------- 1 | abstract contract A { 2 | constructor(function() internal) {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_emit_simple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event e(); 3 | function f() public { 4 | emit e(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_nested_array_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | event E(uint[][]); 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/events_with_same_name_unnamed_arguments.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint); 3 | event A(uint, uint); 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_missing.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | contract C {} 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/104_empty_name_input_parameter.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(uint) public { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/193_positive_integers_to_signed_out_of_bound_max.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | int8 public j = 127; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/ignores_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct a { 3 | uint msg; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/function_type_as_storage_variable.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function (uint, uint) internal returns (uint) f1; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/import_complex_without_from.sol: -------------------------------------------------------------------------------- 1 | import {hello, world}; 2 | // ---- 3 | // ParserError 8208: (21-22): Expected "from". 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/no_function_params.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | function functionName() public {} 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/unknown_pragma.sol: -------------------------------------------------------------------------------- 1 | pragma thisdoesntexist; 2 | // ---- 3 | // SyntaxError 4936: (0-23): Unknown pragma "thisdoesntexist" 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/library_internal_call.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function a() public pure {} 3 | function b() public pure { a(); } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/creation_no_restrict_warning.sol: -------------------------------------------------------------------------------- 1 | contract D {} 2 | contract C { 3 | function f() public { new D(); } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/bytes_calldata.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes calldata x) external pure { 3 | x[1:2]; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/multiple_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract A { event X(uint); } 2 | contract B is A {} 3 | contract C is A {} 4 | contract D is B, C {} 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/getter/simple_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct Y { 3 | uint b; 4 | } 5 | mapping(uint256 => Y) public m; 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/shadowing_private_base_state_vars.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint private i; 3 | } 4 | contract B is A { 5 | uint i; 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_hidden_unicode.sol: -------------------------------------------------------------------------------- 1 | // This is parsed as GPL-3.0: 2 | // SPDX-License-Identifier: GPL-3.0 ⡉⡊⡋⡌⡍⡎⡏⡐⡑⡒ 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/419_interface_structs.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | struct A { 3 | int dummy; 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/438_unused_unnamed_function_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint) pure public { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/497_gasleft.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (uint256 val) { return gasleft(); } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/natspec/docstring_double_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | /// 3 | /// 4 | function vote(uint id) public { 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/address_in_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { 3 | address payable a; 4 | address b; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/unterminated_pragma.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.3 2 | // ---- 3 | // ParserError 2314: (22-22): Expected ';' but got end of source 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/array_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] data; 3 | function test() public { 4 | data.pop(); 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/bytes_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes data; 3 | function test() public { 4 | data.pop(); 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/calldata_dynamic.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint256[] calldata x) external pure { 3 | x[1:2]; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/duplicate_contract.sol: -------------------------------------------------------------------------------- 1 | contract X {} 2 | contract X {} 3 | // ---- 4 | // DeclarationError 2333: (14-27): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/enums/global_enum.sol: -------------------------------------------------------------------------------- 1 | enum E { A } 2 | contract C { 3 | function f() public pure { 4 | E e = E.A; 5 | e; 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_array_indexed_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | event E(uint[] indexed); 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/fallback/returns.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback(bytes calldata _input) external returns (bytes memory _output) {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_function_without_body.sol: -------------------------------------------------------------------------------- 1 | function f(); 2 | // ---- 3 | // TypeError 4668: (0-13): Free functions must be implemented. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_payable.sol: -------------------------------------------------------------------------------- 1 | function fun() payable { 2 | } 3 | // ---- 4 | // TypeError 9559: (0-26): Free functions cannot be payable. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_5.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import {A} from "a"; contract B {} 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/106_empty_name_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public returns (bool) { } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/146_external_argument_assign.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external pure { a = 1; } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/147_external_argument_increment.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external pure { a++; } 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/168_assignment_to_const_var_involving_conversion.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | C constant x = C(address(0x123)); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/169_assignment_to_const_var_involving_expression.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant x = 0x123 + 0x456; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/170_assignment_to_const_var_involving_keccak.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32 constant x = keccak256("abc"); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/568_blockhash.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (bytes32) { return blockhash(3); } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/warnUnused/function_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint a) pure public { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/string/invalid_utf8_sequence.sol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vitelabs/soliditypp/HEAD/test/syntax/solidity/string/invalid_utf8_sequence.sol -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_argument_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_argument_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) private pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/calldata.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | function f(uint[3] calldata) external { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_virtual.sol: -------------------------------------------------------------------------------- 1 | uint constant virtual x; 2 | // ---- 3 | // ParserError 2314: (14-21): Expected identifier but got 'virtual' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/file_level_memory.sol: -------------------------------------------------------------------------------- 1 | uint[] memory constant x = 2; 2 | // ---- 3 | // ParserError 2314: (7-13): Expected identifier but got 'memory' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/non_constant.sol: -------------------------------------------------------------------------------- 1 | uint x = 7; 2 | // ---- 3 | // DeclarationError 8342: (0-10): Only constant variables are allowed at file level. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/nonabiv2_type_abstract.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v1; 2 | abstract contract C { 3 | constructor(uint[][][] memory t) {} 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/empty_struct.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct A {} 3 | } 4 | // ---- 5 | // SyntaxError 5306: (17-28): Defining empty structs is disallowed. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/enums/global_enum_name_clash.sol: -------------------------------------------------------------------------------- 1 | enum E { A } 2 | enum E { A } 3 | // ---- 4 | // DeclarationError 2333: (13-25): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_different_integer_types.sol: -------------------------------------------------------------------------------- 1 | function f(uint24) {} 2 | function f(uint16) {} 3 | function f(int24) {} 4 | function f(bool) {} 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_override.sol: -------------------------------------------------------------------------------- 1 | function fun() override { 2 | } 3 | // ---- 4 | // SyntaxError 1750: (0-27): Free functions cannot override. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_virtual.sol: -------------------------------------------------------------------------------- 1 | function fun() virtual { 2 | } 3 | // ---- 4 | // SyntaxError 4493: (0-26): Free functions cannot be virtual. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/circular_import.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | import "b"; contract C { D d; } 3 | ==== Source: b ==== 4 | import "a"; contract D { C c; } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/allow_empty_duplicated_super_constructor_call.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor() { } } 2 | contract B is A { constructor() A() { } } 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/204_overwrite_memory_location_external.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint[] memory a) external {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/415_interface_functions.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | fallback() external; 3 | function f() external; 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/421_interface_function_parameters.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f(uint a) external returns (bool); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/441_unused_unnamed_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint) { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/461_event_parameter_cannot_shadow_state_variable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address a; 3 | event E(address a); 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/empty_enum.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum foo { } 3 | } 4 | // ---- 5 | // ParserError 3147: (25-26): Enum with no members is not allowed. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/event_with_no_argument_list.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | event e; 3 | } 4 | // ---- 5 | // ParserError 2314: (21-22): Expected '(' but got ';' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/import_simple.sol: -------------------------------------------------------------------------------- 1 | import "hello"; 2 | // ---- 3 | // ParserError 6275: (0-15): Source "hello" not found: File not supplied initially. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_pragma_empty.sol: -------------------------------------------------------------------------------- 1 | pragma experimental; 2 | // ---- 3 | // SyntaxError 9679: (0-20): Experimental feature name is missing. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/bytes0.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes0 b0 = 1; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (15-21): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/argument_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint) storage) internal pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/argument_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint) storage) private pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_array_argument_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) private pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/height.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint a; 4 | function test() external { 5 | a = height(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/array/calldata_dynamic.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | function f(uint[] calldata) external { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/assign_to_storage.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | bytes public b; 3 | function f() public { 4 | b = msg.data[:]; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_override.sol: -------------------------------------------------------------------------------- 1 | uint constant override x = 2; 2 | // ---- 3 | // ParserError 2314: (14-22): Expected identifier but got 'override' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_with_visibility.sol: -------------------------------------------------------------------------------- 1 | uint public constant x = 7; 2 | // ---- 3 | // ParserError 2314: (5-11): Expected identifier but got 'public' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructible_abstract_base.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | constructor() {} 3 | } 4 | contract D is C { 5 | constructor() { } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_nested_array_indexed_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | event E(uint[][] indexed); 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_struct_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | struct S { uint a ; } 4 | event E(S); 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/inheritance/base_not_contract.sol: -------------------------------------------------------------------------------- 1 | function fun() {} 2 | 3 | contract C is fun {} 4 | // ---- 5 | // TypeError 8758: (33-36): Contract expected. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/name.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | function f() public pure returns (string memory) { 3 | return type(Test).name; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/typeNotRegularIdentifierContractName.sol: -------------------------------------------------------------------------------- 1 | contract type { } 2 | // ---- 3 | // ParserError 2314: (9-13): Expected identifier but got 'type' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/445_no_unused_warning_interface_arguments.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f(uint a) pure external returns (uint b); 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/warnUnused/return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint a) { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/import_complex_invalid_from.sol: -------------------------------------------------------------------------------- 1 | import {hello, world} from function; 2 | // ---- 3 | // ParserError 6845: (27-35): Expected import path. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/import_invalid_token.sol: -------------------------------------------------------------------------------- 1 | import function; 2 | // ---- 3 | // ParserError 9478: (7-15): Expected string literal (path), "*" or alias list. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/modifier.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod { if (msg.sender == "vite_61214664a1081e286152011570993a701735f5c2c12198ce63") _; } 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/trailing_dot3.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint a = 2. 3 | // ---- 4 | // ParserError 2314: (29-29): Expected identifier but got end of source 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/var_array.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function f() { var[] a; } 3 | } 4 | // ---- 5 | // ParserError 6933: (31-34): Expected primary expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/version_check.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma solidity < 142857; 3 | pragma solidity >= 0.0; 4 | pragma solidity >= 0.0.0; 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/tupleAssignments/tuple_in_tuple_short.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | int a; 4 | (((a,),)) = ((1,2),3); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/bytes33.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes33 b33 = 1; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (15-22): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/array_argument_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint)[] storage) private pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_argument_public.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) public pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_array_argument_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) internal pure { 3 | } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/cross_language/soliditypp_syntax_in_solidity_source.sol: -------------------------------------------------------------------------------- 1 | pragma solidity >=0.8.0; 2 | 3 | contract A { 4 | function set(uint _item) external {} 5 | } 6 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/abstract_without_contract.sol: -------------------------------------------------------------------------------- 1 | abstract A { } 2 | // ---- 3 | // ParserError 3515: (9-10): Expected keyword "contract", "interface" or "library". 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/calldata_multi.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | function f(uint[3][4] calldata) external { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/file_level_memory_inverted.sol: -------------------------------------------------------------------------------- 1 | uint[] constant memory x = 2; 2 | // ---- 3 | // ParserError 2314: (16-22): Expected identifier but got 'memory' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/conversion/conversion_to_bytes.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (bytes memory) { 3 | return bytes("abc"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/enums/global_enum_contract_name_clash.sol: -------------------------------------------------------------------------------- 1 | enum E { A } 2 | contract E {} 3 | // ---- 4 | // DeclarationError 2333: (13-26): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/freeFunctions/struct_after_function.sol: -------------------------------------------------------------------------------- 1 | function f(S storage g) view returns (uint) { S storage t = g; return t.x; } 2 | struct S { uint x; } 3 | // ---- 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/getter/complex_struct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct Y { 3 | uint a; 4 | uint b; 5 | } 6 | mapping(uint256 => Y) public m; 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/relative_import_multiplex.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: dir/a/b/c ==== 4 | import "../../.././a"; contract B is A {} 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/interface/single_parent.sol: -------------------------------------------------------------------------------- 1 | interface Super { 2 | function test() external returns (uint256); 3 | } 4 | 5 | interface Sub is Super {} 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/add_view.sol: -------------------------------------------------------------------------------- 1 | contract B { function f() virtual public {} } 2 | contract C is B { function f() override public view {} } 3 | // ---- 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/modifiers/legal_modifier_override.sol: -------------------------------------------------------------------------------- 1 | contract A { modifier mod(uint a) virtual { _; } } 2 | contract B is A { modifier mod(uint a) override { _; } } 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/442_named_return_parameter.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public returns (uint a) { 3 | a = 1; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/natspec/docstring_state_variable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | /// @notice example of notice 3 | /// @dev example of dev 4 | uint public state; 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/array_range_no_start.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint256[] calldata x) external pure { 3 | x[:][:10]; 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/function_no_body.sol: -------------------------------------------------------------------------------- 1 | abstract contract test { 2 | function functionName(bytes32 input) public virtual returns (bytes32 out); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/tryCatch/simple_catch.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | try this.f() { 4 | 5 | } catch { 6 | 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /test/syntax/solidity/types/address/address_payable_selfdestruct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(address payable a) public { 3 | selfdestruct(a); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/bytes256.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes256 b256 = 1; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (15-23): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/mapping/array_argument_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(mapping(uint => uint)[] storage) internal pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_argument_external.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint) storage) external pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_array_argument_public.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) public pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/fromhash.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | bytes32 b; 4 | function test() external { 5 | b = fromhash(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/prevhash.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | bytes32 b; 4 | function test() external { 5 | b = prevhash(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/array/calldata_multi_dynamic.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | function f(uint[][] calldata) external { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_with_visibility_inverted.sol: -------------------------------------------------------------------------------- 1 | uint constant public y = 7; 2 | // ---- 3 | // ParserError 2314: (14-20): Expected identifier but got 'public' 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/fallback/payable_fallback_without_receive_only_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback() external payable { } 3 | function f() internal pure { } 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | function(uint) returns (uint) x; 4 | x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/function_initialization.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable x = f(); 3 | 4 | function f() public pure returns (uint) { return 3; } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/initialized_after_ctor.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() { 3 | return; 4 | } 5 | 6 | uint immutable x = 3; 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/function_state_variable.sol: -------------------------------------------------------------------------------- 1 | interface ERC20 { function x() external returns (uint); } 2 | contract C is ERC20 { uint public override x; } 3 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_cr_endings.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. // SPDX-License-Identifier: GPL-3.0 contract C {} -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/057_legal_override_direct.sol: -------------------------------------------------------------------------------- 1 | contract B { function f() public {} } 2 | contract C is B { function f(uint i) public {} } 3 | // ---- 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/174_address_is_constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant x = "vite_61214664a1081e286152011570993a701735f5c2c12198ce63"; 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/global_scope.sol: -------------------------------------------------------------------------------- 1 | contract msg { 2 | } 3 | // ---- 4 | // Warning 2319: (0-16): This declaration shadows a builtin symbol. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/constant_is_keyword.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint constant = 4; 3 | } 4 | // ---- 5 | // ParserError 2314: (30-31): Expected identifier but got '=' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/external_variable.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint external x; 3 | } 4 | // ---- 5 | // ParserError 2314: (19-27): Expected identifier but got 'external' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_empty_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental ""; 2 | // ---- 3 | // SyntaxError 3250: (0-23): Empty experimental feature name is invalid. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_multiple_same_line.sol: -------------------------------------------------------------------------------- 1 | pragma experimental unsupportedName unsupportedName; 2 | // ---- 3 | // SyntaxError 6022: (0-52): Stray arguments. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_unknown_number_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental 123; 2 | // ---- 3 | // SyntaxError 8491: (0-24): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/string/invalid_utf8_in_bytes.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes b1 = "\xa0\x00"; 3 | bytes32 b2 = "\xa0\x00"; 4 | bytes b3 = hex"a000"; 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/global_struct.sol: -------------------------------------------------------------------------------- 1 | struct S { uint a; } 2 | contract C { 3 | function f() public pure { 4 | S memory s = S(42); 5 | s; 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/types/bytesNN_bitnot.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32 b32 = ~bytes32(hex"ff"); 3 | bytes32 b25 = ~bytes25(hex"ff"); 4 | bytes25 b8 = ~bytes8(hex"ff"); 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_array_argument_external.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f(mapping(uint => uint)[] storage) external pure { 3 | } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/constant.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant x = 2; 3 | function k() pure public returns (uint) { 4 | return x; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/account_height.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint a; 4 | function test() external { 5 | a = accountheight(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/blake2b.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | function test(bytes memory data) external pure { 4 | blake2b(data); 5 | } 6 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/pragma/version_check.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp < 142857; 3 | pragma soliditypp >= 0.0; 4 | pragma soliditypp >= 0.0.0; 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructor_override.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() override {} 3 | } 4 | // ---- 5 | // TypeError 1209: (17-42): Constructors cannot override. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructor_virtual.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() virtual {} 3 | } 4 | // ---- 5 | // TypeError 7001: (17-41): Constructors cannot be virtual. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/controlFlow/unreachableCode/comment_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | return; 4 | // unreachable comment 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/emit/emit_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | emit; 4 | } 5 | } 6 | // ---- 7 | // ParserError 5620: (45-46): Expected event name or path. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_function_type_indexed.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event Test(function() external indexed); 3 | function f() public { 4 | emit Test(this.f); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_struct_indexed_v2.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract c { 3 | struct S { uint a ; } 4 | event E(S indexed); 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_function_modifier.sol: -------------------------------------------------------------------------------- 1 | function fun() someModifier { 2 | } 3 | // ---- 4 | // DeclarationError 7920: (15-27): Identifier not found or not unique. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/function_same_name_as_contract.sol: -------------------------------------------------------------------------------- 1 | contract C {} 2 | function C() {} 3 | // ---- 4 | // DeclarationError 2333: (14-29): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/long_name.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable long___name___that___definitely___exceeds___the___thirty___two___byte___limit = 0; 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/004_reference_to_later_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function g() public { f(); } 3 | function f() public {} 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/053_hash_collision_in_interface.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function gsf() public { } 3 | function tgeo() public { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/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/syntax/solidity/parsing/import_complex.sol: -------------------------------------------------------------------------------- 1 | import {hello, world} from "hello"; 2 | // ---- 3 | // ParserError 6275: (0-35): Source "hello" not found: File not supplied initially. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/malformed_enum_declaration.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum foo { WARNING,} 3 | } 4 | // ---- 5 | // ParserError 1612: (33-34): Expected identifier after ',' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/new_invalid_type_name.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | new var; 4 | } 5 | } 6 | // ---- 7 | // ParserError 3546: (35-38): Expected type name 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/mapping/library_storage_parameter_with_mapping.sol: -------------------------------------------------------------------------------- 1 | struct S { mapping(uint => uint)[2] a; } 2 | library L { 3 | function f(S storage s) public {} 4 | } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/soliditypp/interface/interface.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp >=0.8.0; 3 | 4 | interface A { 5 | function f() external; 6 | } 7 | // ---- -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/amount.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint amount; 4 | function test() external payable { 5 | amount = msg.value; 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/random64.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint64 random; 4 | function test() external { 5 | random = random64(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/token_id.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | vitetoken token; 4 | function test() external { 5 | token = msg.token; 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/array/slice/calldata_dynamic_forward.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes calldata x) external { 3 | return this.f(x[1:2]); 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/mapping_constant.sol: -------------------------------------------------------------------------------- 1 | mapping(uint => uint) constant b = b; 2 | // ---- 3 | // DeclarationError 9259: (0-36): Constants of non-value type not yet implemented. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/redefinition_public_constant.sol: -------------------------------------------------------------------------------- 1 | uint constant c = 7; 2 | uint constant c = 8; 3 | // ---- 4 | // DeclarationError 2333: (21-40): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/struct_constant.sol: -------------------------------------------------------------------------------- 1 | struct S { uint x; } 2 | S constant s; 3 | // ---- 4 | // DeclarationError 9259: (21-33): Constants of non-value type not yet implemented. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_storage.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes storage) external {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/publicFunction/function_argument_location_specifier_test_public_memory.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes memory) public {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/denominations/gwei_as_identifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant gwei = 1; 3 | } 4 | // ---- 5 | // ParserError 2314: (28-32): Expected identifier but got 'gwei' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/functionTypes/external_function_type_to_address.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (address) { 3 | return this.f.address; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_contract_struct_5.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import {A} from "a"; 5 | struct B { uint256 a; } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_struct_5.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | struct A { uint256 a; } 3 | ==== Source: b ==== 4 | import {A} from "a"; 5 | struct B { uint256 a; } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_struct_contract_5.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | struct A { uint256 a; } 3 | ==== Source: b ==== 4 | import {A} from "a"; 5 | contract B {} 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/virtual/simple.sol: -------------------------------------------------------------------------------- 1 | contract C 2 | { 3 | function foo() public virtual {} 4 | function foo2() virtual public {} 5 | modifier modi() virtual {_;} 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_bottom.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | contract C {} 3 | // SPDX-License-Identifier: GPL-3.0 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_natspec.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | /// SPDX-License-Identifier: GPL-3.0 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/modifiers/cross_contract_base.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | modifier m() { _; } 3 | } 4 | contract D is C { 5 | function f() C.m public { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/353_callcode_not_deprecated_as_function.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function callcode() pure public { 3 | test.callcode(); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 | 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/fixed_literal_with_double_radix.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | fixed40x40 pi = 3.14.15; 3 | } 4 | // ---- 5 | // ParserError 2314: (34-37): Expected ';' but got 'Number' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/mapping_nonelementary_key_1.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(uint[] => uint) data; 3 | } 4 | // ---- 5 | // ParserError 2314: (26-27): Expected '=>' but got '[' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/mapping_nonelementary_key_4.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | mapping(string[] => uint) data; 3 | } 4 | // ---- 5 | // ParserError 2314: (28-29): Expected '=>' but got '[' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/missing_variable_name_in_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 ; 3 | } 4 | // ---- 5 | // ParserError 2314: (28-29): Expected identifier but got ';' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/single_function_param.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | function functionName(bytes32 input) public returns (bytes32 out) {} 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/broken_version_1.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^0^1; 2 | // ---- 3 | // ParserError 5333: (0-21): Source file requires different compiler version (current compiler is .... 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/calldata.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | struct S { int a; } 4 | function f(S calldata) external { } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/calldata_dynamic.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | struct S { int[] a; } 4 | function f(S calldata) external { } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/contract_global_struct_name_clash.sol: -------------------------------------------------------------------------------- 1 | contract S {} 2 | struct S { uint256 a; } 3 | // ---- 4 | // DeclarationError 2333: (14-37): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/global_struct_contract_name_clash.sol: -------------------------------------------------------------------------------- 1 | struct S { uint256 a; } 2 | contract S {} 3 | // ---- 4 | // DeclarationError 2333: (24-37): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/call_unimplemented_internal_function.sol: -------------------------------------------------------------------------------- 1 | abstract contract A { 2 | function f() public virtual; 3 | function g() public { 4 | f(); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/balance.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint b; 4 | function test(vitetoken token) external { 5 | b = balance(token); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/blake2b_literal.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | bytes32 hash; 4 | function test() external { 5 | hash = blake2b("abc"); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/soliditypp/magic/next_random.solpp: -------------------------------------------------------------------------------- 1 | pragma soliditypp >=0.8.0; 2 | contract Test { 3 | uint64 random; 4 | function test() external { 5 | random = nextrandom(); 6 | } 7 | } -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/invalid_pragma_value.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder something; 2 | // ---- 3 | // SyntaxError 2745: (0-26): Expected either "pragma abicoder v1" or "pragma abicoder v2". 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/calldata_dynamic_encode.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint256[] calldata x) external pure { 3 | abi.encode(x[1:2]); 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/external_constructor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor() external {} 3 | } 4 | // ---- 5 | // TypeError 9239: (17-42): Constructor cannot have visibility. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/internalFunction/function_argument_location_specifier_test_internal_memory.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes memory) internal {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/internalFunction/function_argument_location_specifier_test_internal_storage.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes storage) internal {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_memory.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes memory) internal pure {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_storage.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes storage) internal pure {} 3 | } 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/immutable/non-value_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[] immutable x; 3 | } 4 | // ---- 5 | // TypeError 6377: (17-35): Immutable variables cannot have a non-value type. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/import_is_transitive.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract C { } 3 | ==== Source: b ==== 4 | import "a"; 5 | ==== Source: c ==== 6 | import "b"; 7 | contract D is C {} -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/base_arguments_no_parentheses.sol: -------------------------------------------------------------------------------- 1 | contract Base { 2 | constructor(uint) {} 3 | } 4 | contract Derived is Base(2) { } 5 | contract Derived2 is Base, Derived {} 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_missing_colon.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | // SPDX-License-Identifier GPL-3.0 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_multiline.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | /* SPDX-License-Identifier: GPL-3.0 */ 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_no_whitespace.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | //SPDX-License-Identifier:GPL-3.0 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_whitespace_trailing.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | // NOTE: Trailing space at the end of the line above is intentional. 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/typeNotRegularIdentifierStateVariable.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | uint type; 3 | } 4 | // ---- 5 | // ParserError 2314: (25-29): Expected identifier but got 'type' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/modifiers/modifier_without_underscore.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | modifier m() {} 3 | } 4 | // ---- 5 | // SyntaxError 2883: (33-35): Modifier body does not contain '_'. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/226_inheriting_library.sol: -------------------------------------------------------------------------------- 1 | contract Test {} 2 | library Lib is Test {} 3 | // ---- 4 | // TypeError 9469: (17-39): Library is not allowed to inherit. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/227_library_having_variables.sol: -------------------------------------------------------------------------------- 1 | library Lib { uint x; } 2 | // ---- 3 | // TypeError 9957: (14-20): Library cannot have non-constant state variables 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/420_interface_variables.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | uint a; 3 | } 4 | // ---- 5 | // TypeError 8274: (18-24): Variables cannot be declared in interfaces. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/431_bare_assert.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { assert; } 3 | } 4 | // ---- 5 | // Warning 6133: (44-50): Statement has no effect. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/446_no_unused_warning_abstract_arguments.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | function f(uint a) pure public virtual returns (uint b); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/empty_function.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | function functionName(bytes20 arg1, address addr) public view returns (int id) { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/location_specifiers_with_var.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | function f() { var memory x; } 3 | } 4 | // ---- 5 | // ParserError 6933: (31-34): Expected primary expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/modifier_without_semicolon.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | modifier mod { if (msg.sender == 0) _ } 3 | } 4 | // ---- 5 | // ParserError 2314: (52-53): Expected ';' but got '}' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/struct_definition.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | struct MyStructName { 4 | address addr; 5 | uint256 count; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/wrong_compiler_1.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^99.99.0; 2 | // ---- 3 | // ParserError 5333: (0-25): Source file requires different compiler version (current compiler is .... 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/specialFunctions/abidecode/contract_array.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes calldata x) public pure returns (C[] memory c) { 3 | c = abi.decode(x, (C[])); 4 | } 5 | } -------------------------------------------------------------------------------- /test/syntax/solidity/string/string_unicode.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (string memory) { 3 | return unicode"😃, 😭, and 😈"; 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/string/string_unterminated_no_new_line.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public { "abc\ 3 | // ---- 4 | // ParserError 8936: (47-53): Expected string end-quote. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/global_structs_name_clash.sol: -------------------------------------------------------------------------------- 1 | struct S { uint256 a; } 2 | struct S { uint256 a; } 3 | // ---- 4 | // DeclarationError 2333: (24-47): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 | -------------------------------------------------------------------------------- /test/syntax/solidity/unterminatedBlocks/one_dot.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() pure public { 1. 3 | // ---- 4 | // ParserError 2314: (47-47): Expected identifier but got end of source 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/unterminatedBlocks/zero_dot.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() pure public { 0. 3 | // ---- 4 | // ParserError 2314: (47-47): Expected identifier but got end of source 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/immutable.sol: -------------------------------------------------------------------------------- 1 | contract B { 2 | uint immutable x = 1; 3 | function f() public pure returns (uint) { 4 | return x; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/interface.sol: -------------------------------------------------------------------------------- 1 | interface D { 2 | function f() view external; 3 | } 4 | contract C is D { 5 | function f() override view external {} 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/selected_twice.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v1; 2 | pragma abicoder v1; 3 | // ---- 4 | // SyntaxError 3845: (20-39): ABI coder has already been selected for this source unit. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/unimplemented_functions.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function a() public virtual; 3 | } 4 | // ---- 5 | // TypeError 3656: (0-47): Contract "A" should be marked as abstract. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/calldata_dynamic_convert_to_memory.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes calldata x) external pure returns (bytes memory) { 3 | return x[1:2]; 4 | } 5 | } -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/constructor_without_implementation.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor(); 3 | } 4 | // ---- 5 | // TypeError 5700: (14-28): Constructor must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/externalFunction/function_argument_location_specifier_test_external_calldata.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(bytes calldata) external {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_memory.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes memory) external {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/fallback/payable_fallback_with_inherited_receive.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | receive() external payable { } 3 | } 4 | contract C is A { 5 | fallback() external payable { } 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_functions.sol: -------------------------------------------------------------------------------- 1 | function fun(uint256, uint[] calldata _x, uint[] storage _y) view returns (uint, uint[] calldata) { 2 | return (_y[0], _x); 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/function_type_struct.sol: -------------------------------------------------------------------------------- 1 | library L 2 | { 3 | struct Nested 4 | { 5 | uint y; 6 | } 7 | function f(function(Nested memory) external) external pure {} 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/indexing/index_range_access_assert.sol: -------------------------------------------------------------------------------- 1 | // Used to trigger assert 2 | contract s{} 3 | function f() {s[:][];} 4 | // ---- 5 | // TypeError 1760: (53-57): Types cannot be sliced. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/fallback_receive/fallback_with_override.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback() virtual external {} 3 | } 4 | contract D is C { 5 | fallback() override external {} 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/interface/contract_base.sol: -------------------------------------------------------------------------------- 1 | contract C {} 2 | interface I is C {} 3 | 4 | // ---- 5 | // TypeError 6536: (29-30): Interfaces can only inherit from other interfaces. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/override_shared_base_simple.sol: -------------------------------------------------------------------------------- 1 | contract I { 2 | function f() external {} 3 | } 4 | contract A is I {} 5 | contract B is I {} 6 | contract C is A, B {} 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_crlf_endings.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | // SPDX-License-Identifier: GPL-3.0 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/literalOperations/exponent_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | uint a; 4 | a = a ** 1E5; 5 | a = 0 ** 1E1233; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/lvalues/external_reference_argument.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint256[] calldata x, uint256[] calldata y) external pure { 3 | x = y; 4 | } 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/058_legal_override_indirect.sol: -------------------------------------------------------------------------------- 1 | contract A { function f(uint a) public {} } 2 | contract B { function f() public {} } 3 | contract C is A, B { } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/225_inheriting_from_library.sol: -------------------------------------------------------------------------------- 1 | library Lib {} 2 | contract Test is Lib {} 3 | // ---- 4 | // TypeError 2571: (32-35): Libraries cannot be inherited from. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/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/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/events.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event keccak256(); 3 | } 4 | // ---- 5 | // Warning 2319: (17-35): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/address_public_payable_error.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address public payable a; 3 | } 4 | // ---- 5 | // ParserError 2314: (32-39): Expected identifier but got 'payable' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/emit_without_event.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event A(); 3 | function f() { 4 | emit A; 5 | } 6 | } 7 | // ---- 8 | // ParserError 2314: (49-50): Expected '(' but got ';' 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/location_specifiers_for_state_variables.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint[] memory x; 3 | } 4 | // ---- 5 | // ParserError 2314: (23-29): Expected identifier but got 'memory' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/multiple_modifier_overrides.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | modifier f() override override {} 3 | } 4 | // ---- 5 | // ParserError 9102: (39-47): Override already specified. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/payable_accessor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint payable x; 3 | } 4 | // ---- 5 | // ParserError 9106: (22-29): State mutability can only be specified for address types. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/tuples_without_commas.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | uint a = (2 2); 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (43-44): Expected ',' but got 'Number' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/empty_version.sol: -------------------------------------------------------------------------------- 1 | pragma solidity; 2 | // ---- 3 | // ParserError 1684: (0-16): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_pragma_unknown_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental unsupportedName; 2 | // ---- 3 | // SyntaxError 8491: (0-36): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_unknown_quoted_string_literal.sol: -------------------------------------------------------------------------------- 1 | pragma experimental "unsupportedName"; 2 | // ---- 3 | // SyntaxError 8491: (0-38): Unsupported experimental feature name. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/address_member_declaration.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S { uint address; } 3 | } 4 | // ---- 5 | // ParserError 2314: (33-40): Expected identifier but got 'address' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/library_to_address.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | } 3 | contract C { 4 | function f() public pure returns (address) { 5 | return address(L); 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/unexpected.sol: -------------------------------------------------------------------------------- 1 | unexpected 2 | // ---- 3 | // ParserError 7858: (0-10): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/array/access_to_array_push.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint[] x; 3 | function g() public returns (uint) { 4 | return x.push(); 5 | } 6 | } 7 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/tuples.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[(1,2)] a15; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/dataLocations/libraryExternalFunction/function_argument_location_specifier_test_external_calldata.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes calldata) external {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/denominations/deprecated_year.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 3 years; 3 | } 4 | // ---- 5 | // TypeError 4820: (32-39): Using "years" as a unit denomination is deprecated. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/denominations/szabo_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | uint x = 1 szabo; 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (45-50): Expected ';' but got identifier 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/immutable/reading_after_initialization.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable x = 0; 3 | uint y = 0; 4 | 5 | function f() internal { 6 | y = x + 1; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/function_definition.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | assembly { 4 | function f (a, b , c ) -> y,x,z { 5 | } 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_natspec_multiline.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | /** SPDX-License-Identifier: GPL-3.0 */ 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_no_whitespace_multiline.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | /*SPDX-License-Identifier:GPL-3.0*/ 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/139_no_name_suggestion.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function g() public { fun(); } 3 | } 4 | // ---- 5 | // DeclarationError 7576: (39-42): Undeclared identifier. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/175_uninitialized_const_variable.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint constant y; 3 | } 4 | // ---- 5 | // TypeError 4266: (19-34): Uninitialized "constant" variable. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/252_using_for_not_library.sol: -------------------------------------------------------------------------------- 1 | contract D { } 2 | contract C { 3 | using D for uint; 4 | } 5 | // ---- 6 | // TypeError 4357: (38-39): Library name expected. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/free_and_constant.sol: -------------------------------------------------------------------------------- 1 | uint constant c = 7; 2 | function c() returns (uint) {} 3 | // ---- 4 | // DeclarationError 2333: (21-51): Identifier already declared. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/storage_variables.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint msg; 3 | } 4 | // ---- 5 | // Warning 2319: (17-25): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/constructor_public_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() public public {} 3 | } 4 | // ---- 5 | // ParserError 9439: (36-42): Visibility already specified as "public". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/mapping_from_address_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | mapping(address payable => uint) m; 3 | } 4 | // ---- 5 | // ParserError 2314: (33-40): Expected '=>' but got 'payable' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/receiveEther/arguments.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | receive(uint256) external payable {} 3 | } 4 | // ---- 5 | // TypeError 6857: (24-33): Receive ether function cannot take parameters. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/visibility/interface/function_private.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() private; 3 | } 4 | // ---- 5 | // TypeError 1560: (15-36): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/visibility/interface/function_public.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() public; 3 | } 4 | // ---- 5 | // TypeError 1560: (15-35): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/interface.sol: -------------------------------------------------------------------------------- 1 | interface B { } 2 | abstract interface A { } 3 | // ---- 4 | // TypeError 9348: (16-40): Interfaces do not need the "abstract" keyword, they are abstract implicitly. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/inline_array.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[[2]] a15; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-25): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/invalid_expression_5.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[3/0] ids; 3 | } 4 | // ---- 5 | // TypeError 6020: (22-25): Operator / not compatible with types int_const 3 and int_const 0 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[8**90] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/cyclic_dependency_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = a; 3 | } 4 | // ---- 5 | // TypeError 6161: (17-36): The value of the constant a has a cyclic dependency via a. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/dataLocations/libraryInternalFunction/function_argument_location_specifier_test_internal_calldata.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f(bytes calldata) internal pure {} 3 | } 4 | // ---- 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/denominations/finney_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() { 3 | uint x = 1 finney; 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (45-51): Expected ';' but got identifier 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/double_stateVariable_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 variable; 3 | uint128 variable; 4 | } 5 | // ---- 6 | // DeclarationError 2333: (36-52): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/immutable/unrelated_reading.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable x = 1; 3 | 4 | function readX() internal pure returns(uint) { 5 | return x + 3; 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/fallback_receive/receive_with_override.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | receive() virtual external payable {} 3 | } 4 | contract D is C { 5 | receive() override external payable {} 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/interface_virtual_warning.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function foo() virtual external; 3 | } 4 | // ---- 5 | // Warning 5815: (15-47): Interface functions are implicitly "virtual" 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/modifiers/constructor_as_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() C() {} 3 | } 4 | // ---- 5 | // TypeError 4659: (31-34): Referenced declaration is neither modifier nor base class. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/multiSource/import_not_found.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | import "b"; 3 | contract C {} 4 | // ---- 5 | // ParserError 6275: (a:0-11): Source "b" not found: File not supplied initially. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/157_array_of_undeclared_type.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | a[] public foo; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (17-18): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/345_unused_return_value.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function g() public returns (uint) {} 3 | function f() public { 4 | g(); 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/423_using_interface.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | contract C is I { 5 | function f() public override { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/430_bare_selfdestruct.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { selfdestruct; } 3 | } 4 | // ---- 5 | // Warning 6133: (44-56): Statement has no effect. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/natspec/docstring_empty_tag.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | /// @param 3 | function vote(uint id) public {} 4 | } 5 | // ---- 6 | // DocstringParsingError 3335: No param name given 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/address_constant_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | address constant payable b = address(0); 3 | } 4 | // ---- 5 | // ParserError 2314: (34-41): Expected identifier but got 'payable' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/constructor_internal_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() internal public {} 3 | } 4 | // ---- 5 | // ParserError 9439: (38-44): Visibility already specified as "internal". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/constructor_public_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() public internal {} 3 | } 4 | // ---- 5 | // ParserError 9439: (36-44): Visibility already specified as "public". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/single_function_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function(uint a,) {} 3 | } 4 | // ---- 5 | // ParserError 7591: (32-33): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/broken_version_2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity pragma; 2 | // ---- 3 | // ParserError 1684: (0-23): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/broken_version_4.sol: -------------------------------------------------------------------------------- 1 | pragma solidity (8.0.0); 2 | // ---- 3 | // ParserError 1684: (0-24): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/broken_version_5.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 88_; 2 | // ---- 3 | // ParserError 1684: (0-20): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/structs/recursion/recursive_struct_nested_mapping_storage.sol: -------------------------------------------------------------------------------- 1 | library a { 2 | struct b { 3 | mapping (uint => b) c ; 4 | } 5 | function d(b storage) public {} 6 | } 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/function_call_fail.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint y) public pure { 3 | (4(y)) = 2; 4 | } 5 | } 6 | // ---- 7 | // TypeError 5704: (59-63): Type is not callable 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/unchecked/unchecked_function_body.sol: -------------------------------------------------------------------------------- 1 | function f() pure returns (uint) unchecked {} 2 | // ---- 3 | // ParserError 5296: (33-42): "unchecked" blocks can only be used inside regular blocks. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/visibility/interface/function_internal.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() internal; 3 | } 4 | // ---- 5 | // TypeError 1560: (15-37): Functions in interfaces must be declared external. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/conflicting_settings_reverse.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v1; 2 | pragma abicoder v2; 3 | // ---- 4 | // SyntaxError 3845: (20-39): ABI coder has already been selected for this source unit. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/pop/storage_with_mapping_pop.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | mapping(uint=>uint)[] array; 3 | mapping(uint=>uint) map; 4 | function f() public { 5 | array.pop(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/constantEvaluator/unary_fine.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | int8 constant a = -7; 3 | function f() public pure { 4 | uint[-a] memory x; 5 | x[0] = 2; 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/returns_in_constructor.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor() returns (uint a) { } 3 | } 4 | // ---- 5 | // TypeError 9712: (39-47): Non-empty "returns" directive for constructor. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/constructor/two_constructors.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | constructor(uint) { } 3 | constructor() {} 4 | } 5 | // ---- 6 | // DeclarationError 7997: (40-56): More than one constructor defined. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/events/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/syntax/solidity/freeFunctions/free_receive.sol: -------------------------------------------------------------------------------- 1 | receive() {} 2 | // ---- 3 | // ParserError 7858: (0-7): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/override_library.sol: -------------------------------------------------------------------------------- 1 | library L {} 2 | contract C { 3 | function f() public override (L) {} 4 | } 5 | // ---- 6 | // TypeError 1130: (57-58): Invalid use of a library name. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/inlineAssembly/const_forward_reference.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | pop(add(add(1, 2), c)) 5 | } 6 | } 7 | int constant c = 1; 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/leave.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | function f() { 5 | leave 6 | } 7 | } 8 | } 9 | } 10 | // ---- 11 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/no_unused_variable_warning.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a; 4 | assembly { 5 | a := 1 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/literalOperations/mod_zero.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant b3 = 1 % 0; 3 | } 4 | // ---- 5 | // TypeError 2271: (36-41): Operator % not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/076_fallback_function_in_library.sol: -------------------------------------------------------------------------------- 1 | library C { 2 | fallback() external {} 3 | } 4 | // ---- 5 | // TypeError 5982: (16-38): Libraries cannot have fallback functions. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/298_invalid_fixed_types_0x7_mxn.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | fixed0x7 a = .3; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (20-28): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/354_payable_in_library.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | function f() payable public {} 3 | } 4 | // ---- 5 | // TypeError 7708: (19-49): Library functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/warnUnused/local.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a; 4 | } 5 | } 6 | // ---- 7 | // Warning 2072: (52-58): Unused local variable. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/constructor_internal_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() internal internal {} 3 | } 4 | // ---- 5 | // ParserError 9439: (38-46): Visibility already specified as "internal". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/constructor_payable_payable.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | constructor() payable payable {} 3 | } 4 | // ---- 5 | // ParserError 9680: (37-44): State mutability already specified as "payable". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/types/var_empty_decl_3.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | var (d, e,); 4 | } 5 | } 6 | // ---- 7 | // ParserError 6933: (52-55): Expected primary expression. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/visibility/function_no_visibility.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure { } 3 | } 4 | // ---- 5 | // SyntaxError 4937: (17-38): No visibility specified. Did you intend to add "public"? 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/conflicting_settings.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | pragma abicoder v1; 3 | // ---- 4 | // SyntaxError 3845: (34-53): ABI coder has already been selected for this source unit. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/abiEncoder/same_setting_twice.sol: -------------------------------------------------------------------------------- 1 | pragma experimental ABIEncoderV2; 2 | pragma abicoder v2; 3 | // ---- 4 | // SyntaxError 3845: (34-53): ABI coder has already been selected for this source unit. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/invalid/library_array.sol: -------------------------------------------------------------------------------- 1 | library L {} 2 | contract C { 3 | function f() public { 4 | L[] memory x; 5 | } 6 | } 7 | // ---- 8 | // TypeError 1130: (51-52): Invalid use of a library name. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/bytes32_too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32[8**90] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/invalid_expression_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[-true] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/invalid_expression_2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[true/1] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/invalid_expression_3.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1/true] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-28): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/parameter_too_large.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bytes32[1263941234127518272] memory) public pure {} 3 | } 4 | // ---- 5 | // TypeError 1534: (26-61): Type too large for memory. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/library_array.sol: -------------------------------------------------------------------------------- 1 | library L {} 2 | contract C { 3 | function f() public pure { 4 | new L[](2); 5 | } 6 | } 7 | // ---- 8 | // TypeError 1130: (63-64): Invalid use of a library name. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/constants/constant_natspec_user.sol: -------------------------------------------------------------------------------- 1 | /// Documentation 2 | uint constant x = 8; 3 | // ---- 4 | // DocstringParsingError 6546: (0-18): Documentation tag @notice not valid for file-level variables. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/denominations/szabo_finney_identifiers.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint finney) public pure returns (uint szabo) { 3 | // These used to be denominations. 4 | szabo = finney; 5 | } 6 | } -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_fallback.sol: -------------------------------------------------------------------------------- 1 | fallback(){} 2 | // ---- 3 | // ParserError 7858: (0-8): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionCalls/int_not_callable.sol: -------------------------------------------------------------------------------- 1 | contract C 2 | { 3 | function f ( ) public { 4 | ( ( 1 ( 3 ) ) , 2 ); 5 | } 6 | } 7 | // ---- 8 | // TypeError 5704: (53-60): Type is not callable 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionCalls/lowlevel_call_options.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function foo() internal { 3 | (bool success, ) = address(10).call{value: 7}(""); 4 | success; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionCalls/new_library.sol: -------------------------------------------------------------------------------- 1 | library L {} 2 | contract C { 3 | function f() public pure { 4 | new L(); 5 | } 6 | } 7 | // ---- 8 | // TypeError 1130: (63-64): Invalid use of a library name. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/warn_function_type_parameters_with_names.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(uint a) f; 3 | } 4 | // ---- 5 | // Warning 6162: (26-32): Naming function type parameters is deprecated. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/uninitialized.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint immutable x; 3 | } 4 | // ---- 5 | // TypeError 2658: (0-36): Construction control flow ends without initializing all immutable state variables. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/relative_import.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | import "./dir/b"; contract A is B {} 3 | ==== Source: dir/b ==== 4 | contract B {} 5 | ==== Source: dir/c ==== 6 | import "../a"; contract C is A {} -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/shadowing_base_state_vars.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint i; 3 | } 4 | contract B is A { 5 | uint i; 6 | } 7 | // ---- 8 | // DeclarationError 9097: (43-49): Identifier already declared. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/license/license_nonempty_line.sol: -------------------------------------------------------------------------------- 1 | // This test is actually useless, as the test suite adds the automatic preamble. 2 | pragma solidity >= 0.0; // SPDX-License-Identifier: GPL-3.0 3 | contract C {} 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/typeNotRegularIdentifierFunction.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | function type() public pure { 3 | } 4 | } 5 | // ---- 6 | // ParserError 2314: (29-33): Expected identifier but got 'type' 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/typeNotRegularIdentifierParameter.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | function f(uint type) public pure { 3 | } 4 | } 5 | // ---- 6 | // ParserError 2314: (36-40): Expected ',' but got 'type' 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/260_library_memory_struct.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | library c { 3 | struct S { uint x; } 4 | function f() public returns (S memory) {} 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/268_function_overload_array_type.sol: -------------------------------------------------------------------------------- 1 | abstract contract M { 2 | function f(uint[] memory) public virtual; 3 | function f(int[] memory) public virtual; 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/528_fallback_marked_private.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback () private { } 3 | } 4 | // ---- 5 | // TypeError 1159: (17-40): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/529_fallback_marked_public.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback () public { } 3 | } 4 | // ---- 5 | // TypeError 1159: (17-39): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shadowsBuiltin/functions.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function keccak256() pure public {} 3 | } 4 | // ---- 5 | // Warning 2319: (17-52): This declaration shadows a builtin symbol. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/assembly_invalid_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly "failasm" {} 4 | } 5 | } 6 | // ---- 7 | // ParserError 4531: (55-64): Only "evmasm" supported. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/multiple_function_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function(uint a, uint b,) {} 3 | } 4 | // ---- 5 | // ParserError 7591: (40-41): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/single_return_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() returns (uint a,) {} 3 | } 4 | // ---- 5 | // ParserError 7591: (43-44): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/experimental_test_warning.sol: -------------------------------------------------------------------------------- 1 | pragma experimental __test; 2 | // ---- 3 | // Warning 2264: (0-27): Experimental features are turned on. Do not use experimental features on live deployments. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/byte.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | byte public a; 3 | } 4 | // ---- 5 | // ParserError 9182: (17-21): Function, variable, struct or modifier declaration expected, but got reserved keyword 'byte' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/global_struct_recursive.sol: -------------------------------------------------------------------------------- 1 | struct s1 { s2 x; } 2 | struct s2 { s1 y; } 3 | 4 | contract C { 5 | // whatever 6 | } 7 | // ---- 8 | // TypeError 2046: (0-19): Recursive struct definition. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/hex_literal_bitnot.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32 b = ~hex"00ff11"; 3 | } 4 | // ---- 5 | // TypeError 4907: (29-41): Unary operator ~ cannot be applied to type literal_string hex"00ff11" 6 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/function/interface_function.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp >=0.8.0; 3 | 4 | interface InterfaceSyncFunctionContract { 5 | function f() external; 6 | } 7 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/array/length/not_convertible_to_integer.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[true] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-26): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/conversion/convert_to_super_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | super().x; 4 | } 5 | } 6 | // ---- 7 | // TypeError 1744: (52-59): Cannot convert to the super type. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/free_constructor.sol: -------------------------------------------------------------------------------- 1 | constructor() {} 2 | // ---- 3 | // ParserError 7858: (0-11): Expected pragma, import directive or contract/interface/library/struct/enum/constant/function definition. 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/functionTypes/delete_function_type_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | delete f; 4 | } 5 | } 6 | // ---- 7 | // TypeError 4247: (54-55): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/globalFunctions/now_deprecate.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | now; 4 | } 5 | } 6 | // ---- 7 | // TypeError 7359: (38-41): "now" has been deprecated. Use "block.timestamp" instead. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/simple_alias.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: dir/a/b/c ==== 4 | import "../../.././a" as x; contract B is x.A { fallback() external { x.A r = x.A(address(20)); r; } } 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/external_turns_public_no_params.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function f() external virtual pure {} 3 | } 4 | contract B is A { 5 | function f() public override pure { 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/unimplemented_without_virtual.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | function f() external; 3 | } 4 | // ---- 5 | // TypeError 5424: (23-45): Functions without implementation must be marked virtual. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/literalOperations/division_by_zero.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 1 / 0; 3 | } 4 | // ---- 5 | // TypeError 2271: (35-40): Operator / not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/056_cyclic_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract A is B { } 2 | contract B is A { } 3 | // ---- 4 | // TypeError 2449: (14-15): Definition of base has to precede definition of derived contract 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/096_access_to_default_function_visibility.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f() public {} 3 | } 4 | contract d { 5 | function g() public { c(address(0)).f(); } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/113_exp_warn_literal_base_1.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint8 x = 100; 4 | return 10**x; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/116_shift_warn_literal_base_1.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint8 x = 100; 4 | return 10 << x; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/198_integer_boolean_not.sol: -------------------------------------------------------------------------------- 1 | contract test { fallback() external { uint x = 1; !x; } } 2 | // ---- 3 | // TypeError 4907: (50-52): Unary operator ! cannot be applied to type uint256 4 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/300_invalid_fixed_types_7x8_mxn.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | fixed7x8 c = 3.12345678; 3 | } 4 | // ---- 5 | // DeclarationError 7920: (20-28): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/527_fallback_marked_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback () internal { } 3 | } 4 | // ---- 5 | // TypeError 1159: (17-41): Fallback function must be defined as "external". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/natspec/docstring_empty_description.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | /// @param id 3 | function vote(uint id) public {} 4 | } 5 | // ---- 6 | // DocstringParsingError 9942: No description given for param id 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/natspec/docstring_named_return_parameter.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | /// @return value The value returned by this function. 3 | function vote() public virtual returns (uint value); 4 | } 5 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/enum_valid_declaration.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | enum validEnum { Value1, Value2, Value3, Value4 } 3 | constructor() { 4 | a = validEnum.Value3; 5 | } 6 | validEnum a; 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/literal_constants_with_ether_subdenominations_in_expressions.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | constructor() 3 | { 4 | a = 1 wei * 100 wei + 7 gwei - 3; 5 | } 6 | uint256 a; 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/location_specifiers_for_state_variables_multi.sol: -------------------------------------------------------------------------------- 1 | contract Foo { 2 | uint[] memory storage calldata x; 3 | } 4 | // ---- 5 | // ParserError 2314: (23-29): Expected identifier but got 'memory' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/parsing/payable_without_arguments.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | address payable q = payable; 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (70-71): Expected '(' but got ';' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 2314: (76-77): Expected identifier but got ';' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/var_storage_var.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | var a; 3 | } 4 | // ---- 5 | // ParserError 9182: (17-20): Function, variable, struct or modifier declaration expected, but got reserved keyword 'var' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/wrong_compiler_2.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^99.99.0; 2 | this is surely invalid 3 | // ---- 4 | // ParserError 5333: (0-25): Source file requires different compiler version (current compiler is .... 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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 8381: (60-70): Tuple component cannot be empty. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/callvalue_payable_assembly_function.sol: -------------------------------------------------------------------------------- 1 | contract C 2 | { 3 | function f(uint x) public payable { 4 | assembly { 5 | x := callvalue() 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/overriding_no_restrict_warning.sol: -------------------------------------------------------------------------------- 1 | contract D { 2 | uint x; 3 | function f() virtual public { x = 2; } 4 | } 5 | contract C is D { 6 | function f() public override {} 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/abstract_only.sol: -------------------------------------------------------------------------------- 1 | abstract 2 | // ---- 3 | // ParserError 3515: (9-9): Expected keyword "contract", "interface" or "library". 4 | // ParserError 2314: (9-9): Expected identifier but got end of source 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/uint_too_large_multidim.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[8**90][500] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-27): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/comments/unicode_direction_in_source_2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(bool b) public pure 3 | { 4 | uint a = 10; ‬ 5 | } 6 | } 7 | // ---- 8 | // ParserError 8936: (75-76): Invalid token. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/imports/name_clash_in_import_1.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import "a"; contract A {} 5 | // ---- 6 | // DeclarationError 2333: (b:12-25): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 3383: (65-70): Out of bounds array access. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/indexing/array_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes memory a; 4 | a[]; 5 | } 6 | } 7 | // ---- 8 | // TypeError 9689: (61-64): Index expression cannot be omitted. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 1859: (56-61): Out of bounds array access. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/indexing/fixedbytes_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | bytes32 b; 4 | b[]; 5 | } 6 | } 7 | // ---- 8 | // TypeError 8830: (56-59): Index expression cannot be omitted. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/virtual/library_err.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() internal pure virtual returns (uint) { return 0; } 3 | } 4 | // ---- 5 | // TypeError 7801: (16-79): Library functions cannot be "virtual". 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/356_payable_internal.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable internal {} 3 | } 4 | // ---- 5 | // TypeError 5587: (20-52): "internal" and "private" functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/357_payable_private.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() payable private {} 3 | } 4 | // ---- 5 | // TypeError 5587: (20-51): "internal" and "private" functions cannot be payable. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/425_interface_implement_public_contract.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external; 3 | } 4 | contract C is I { 5 | function f() public override { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/warnUnused/local_assignment.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() pure public { 3 | uint a = 1; 4 | } 5 | } 6 | // ---- 7 | // Warning 2072: (52-58): Unused local variable. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/single_event_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event Test(uint a,); 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError 7591: (34-35): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 2314: (76-77): Expected '=' but got ';' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/receiveEther/msg_data_in_receive.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | receive() external payable { msg.data; } 3 | } 4 | // ---- 5 | // TypeError 7139: (46-54): "msg.data" cannot be used inside of "receive" function. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/receiveEther/pure_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | receive() external pure { x = 2; } 4 | } 5 | // ---- 6 | // TypeError 7793: (29-63): Receive ether function must be payable, but is "pure". 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/receiveEther/view_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | receive() external view { x = 2; } 4 | } 5 | // ---- 6 | // TypeError 7793: (29-63): Receive ether function must be payable, but is "view". 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/address/codehash.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view returns (bytes32) { 3 | return address(this).codehash; 4 | } 5 | } 6 | // ==== 7 | // EVMVersion: >=constantinople 8 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/types/mapping/enum_mapping.sol: -------------------------------------------------------------------------------- 1 | enum E { A, B, C } 2 | contract C { 3 | mapping(E => bool) e; 4 | function f(E v) public view returns (bool, bool) { 5 | return (e[v], e[E.A]); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/function/external_function.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp >=0.8.0; 3 | 4 | contract ExternalSyncFunctionContract { 5 | function f() external { 6 | } 7 | } 8 | // ---- -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/bytes32_too_large_multidim.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | bytes32[8**90][500] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (25-30): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/invalid_expression_4.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[1.111111E1111111111111] ids; 3 | } 4 | // ---- 5 | // TypeError 5462: (22-44): Invalid array length, expected integer literal or constant expression. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/controlFlow/unreachableCode/double_revert.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | revert(); 4 | revert(); 5 | } 6 | } 7 | // ---- 8 | // Warning 5740: (70-78): Unreachable code. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/controlFlow/unreachableCode/revert.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | revert(); 4 | uint a = 0; a; 5 | } 6 | } 7 | // ---- 8 | // Warning 5740: (70-83): Unreachable code. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/conversion/convert_to_super_nonempty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | super(this).f(); 4 | } 5 | } 6 | // ---- 7 | // TypeError 1744: (52-63): Cannot convert to the super type. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/as_function_param.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint immutable) public pure {} 3 | } 4 | // ---- 5 | // DeclarationError 8297: (28-42): The "immutable" keyword can only be used for state variables. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/immutable/external_function_pointer.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() external immutable f; 3 | } 4 | // ---- 5 | // TypeError 3366: (17-48): Immutable variables of external function type are not yet supported. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_2.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import "a" as A; contract A {} 5 | // ---- 6 | // DeclarationError 2333: (b:17-30): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_enum.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | enum E { A } 3 | ==== Source: b ==== 4 | import "a"; 5 | enum E { A } 6 | // ---- 7 | // DeclarationError 2333: (b:12-24): Identifier already declared. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/indexing/function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | f[0]; 4 | } 5 | } 6 | // ---- 7 | // TypeError 2614: (41-42): Indexed expression has to be a type, mapping or array (is function ()) 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/reference_non_base_ctor.sol: -------------------------------------------------------------------------------- 1 | contract X {} 2 | contract D { 3 | constructor() X(5) {} 4 | } 5 | // ---- 6 | // TypeError 4659: (45-49): Referenced declaration is neither modifier nor base class. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/literalOperations/mod_zero_complex.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant b3 = 1 % (-4+((2)*2)); 3 | } 4 | // ---- 5 | // TypeError 2271: (36-52): Operator % not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/literals/hex_string_leading_underscore.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | hex"_1234"; 4 | } 5 | } 6 | // ---- 7 | // ParserError 8936: (52-57): Invalid use of number separator '_'. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/memberLookup/internal_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function () internal returns (uint) x; 3 | constructor() { 4 | C.x = g; 5 | } 6 | function g() public pure returns (uint) {} 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/typeNotRegularIdentifierVariable.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | function f() public pure { 3 | uint type; 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (60-64): Expected ';' but got 'type' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/044_returning_multi_dimensional_arrays_new_abi.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | 3 | contract C { 4 | function f() public pure returns (string[][] memory) {} 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/188_string_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | string s; 3 | function f() public { bytes1 a = s[2]; } 4 | } 5 | // ---- 6 | // TypeError 9961: (64-68): Index access for string is not possible. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/245_tuples_empty_components.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | (1,,2); 4 | } 5 | } 6 | // ---- 7 | // TypeError 8381: (47-53): Tuple component cannot be empty. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/shift_warn_literal_large_shift_amount.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() pure public returns(uint) { 3 | uint x = 100; 4 | return 10 << x; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/function_normal_comments.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVar; 3 | // We won't see this comment 4 | function functionName(bytes32 input) public returns (bytes32 out) {} 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/function_type_as_storage_variable_with_modifiers.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function (uint, uint) modifier1() returns (uint) f1; 3 | } 4 | // ---- 5 | // ParserError 2314: (48-49): Expected ';' but got '(' 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/multiple_return_param_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function() returns (uint a, uint b,) {} 3 | } 4 | // ---- 5 | // ParserError 7591: (54-55): Unexpected trailing comma in parameter list. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/wrong_compiler_3.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^99.99.0; 2 | contract C { 3 | uint ; 4 | } 5 | // ---- 6 | // ParserError 5333: (0-25): Source file requires different compiler version (current compiler is .... 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/pragma/unterminated_version.sol: -------------------------------------------------------------------------------- 1 | pragma solidity 0.4.3 2 | pragma abicoder v2; 3 | // ---- 4 | // ParserError 1684: (0-41): Found version pragma, but failed to parse it. Please ensure there is a trailing semicolon. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/scoping/function_state_variable_conflict.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint) public pure {} 3 | uint public f = 0; 4 | } 5 | // ---- 6 | // DeclarationError 2333: (53-70): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/scoping/name_shadowing2.sol: -------------------------------------------------------------------------------- 1 | function e() {} 2 | contract test { 3 | function f() pure public { uint e; e = 0; } 4 | } 5 | // ---- 6 | // Warning 2519: (63-69): This declaration shadows an existing declaration. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/scoping/state_variable_function_conflict.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint public f = 0; 3 | function f(uint) public pure {} 4 | } 5 | // ---- 6 | // DeclarationError 2333: (40-71): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/specialFunctions/abidecode/abi_decode_empty.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | abi.decode("abc", ()); 4 | } 5 | } 6 | // ---- 7 | // Warning 6133: (52-73): Statement has no effect. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/string/string_escapes.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public pure returns (bytes32) { 3 | bytes32 escapeCharacters = "\n\r\'\"\\"; 4 | return escapeCharacters; 5 | } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/address/address_to_contract_receive.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (C c) { 3 | c = C(payable(address(2))); 4 | } 5 | receive() external payable { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/address/payable_to_contract_receive.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (C c) { 3 | c = C(payable(address(2))); 4 | } 5 | receive() external payable { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_nested_storage.sol: -------------------------------------------------------------------------------- 1 | library Test { 2 | struct Nested { mapping(uint => uint)[2][] a; uint y; } 3 | struct X { Nested n; } 4 | function f(X storage x) external {} 5 | } 6 | // ---- 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/mapping/library_storage_parameter_with_nested_mapping.sol: -------------------------------------------------------------------------------- 1 | library Test { 2 | struct Nested { mapping(uint => uint)[2][] a; } 3 | struct X { Nested n; } 4 | function f(X storage x) public {} 5 | } 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/unchecked/unchecked_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | modifier m() { unchecked { _; } } 3 | } 4 | // ---- 5 | // SyntaxError 2573: (44-45): The placeholder statement "_" cannot be used inside an "unchecked" block. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/assembly_constantinople.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view { 3 | assembly { pop(extcodehash(0)) } 4 | } 5 | } 6 | // ==== 7 | // EVMVersion: >=constantinople 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/pragma/low_version.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp >= 100.0.0; 3 | // ---- 4 | // ParserError 5333: (36-65): Source file requires different compiler version (current compiler is .... -------------------------------------------------------------------------------- /test/syntax/smoke_test.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint256 stateVariable1; 3 | function fun(uint256 arg1) public { uint256 y; y = arg1; } 4 | } 5 | // ---- 6 | // Warning 2018: (42-100): Function state mutability can be restricted to pure 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/bound/bound_call.sol: -------------------------------------------------------------------------------- 1 | library D { function double(uint self) internal pure returns (uint) { return 2*self; } } 2 | contract C { 3 | using D for uint; 4 | function f(uint a) public pure { 5 | a.double(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/bound/bound_no_call.sol: -------------------------------------------------------------------------------- 1 | library D { function double(uint self) public pure returns (uint) { return 2*self; } } 2 | contract C { 3 | using D for uint; 4 | function f(uint a) public pure { 5 | a.double; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/events/double_event_declaration.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | event A(uint i); 3 | event A(uint i); 4 | } 5 | // ---- 6 | // DeclarationError 5883: (20-36): Event with same name and parameter types defined twice. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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/syntax/solidity/fallback/pure_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | fallback() external pure { x = 2; } 4 | } 5 | // ---- 6 | // TypeError 4575: (29-64): Fallback function must be payable or non-payable, but is "pure". 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/fallback/view_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | fallback() external view { x = 2; } 4 | } 5 | // ---- 6 | // TypeError 4575: (29-64): Fallback function must be payable or non-payable, but is "view". 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/this_in_free_function.sol: -------------------------------------------------------------------------------- 1 | contract C {} 2 | function f() { 3 | this; 4 | } 5 | // ---- 6 | // DeclarationError 7576: (33-37): Undeclared identifier. "this" is not (or not yet) visible at this point. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/delete_external_function_type_invalid.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | delete this.f; 4 | } 5 | } 6 | // ---- 7 | // TypeError 4247: (54-60): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/payable_internal_function_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function (uint) internal payable returns (uint) x; 3 | } 4 | // ---- 5 | // TypeError 7415: (17-66): Only external function types can be payable. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_4.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import {A} from "a"; contract A {} 5 | // ---- 6 | // DeclarationError 2333: (b:21-34): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/fallback_receive/fallback_with_override_intermediate.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | fallback() virtual external {} 3 | } 4 | contract D is C { 5 | } 6 | contract E is D { 7 | fallback() override external {} 8 | } 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/string_literal_switch_case.yul: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | switch codesize() 5 | case "1" {} 6 | case "2" {} 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/literalOperations/division_by_zero_complex.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant a = 1 / ((1+3)-4); 3 | } 4 | // ---- 5 | // TypeError 2271: (35-48): Operator / not compatible with types int_const 1 and int_const 0 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/literals/hex_string_duplicate_underscore.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | hex"12__34"; 4 | } 5 | } 6 | // ---- 7 | // ParserError 8936: (52-60): Invalid use of number separator '_'. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/literals/hex_string_misaligned_underscore.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | hex"1_234"; 4 | } 5 | } 6 | // ---- 7 | // ParserError 8936: (52-56): Expected even number of hex-nibbles. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/literals/hex_string_trailing_underscore.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | hex"1234_"; 4 | } 5 | } 6 | // ---- 7 | // ParserError 8936: (52-61): Invalid use of number separator '_'. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/lvalues/calldata_index_access.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint256[] calldata x) external pure { 3 | x[0] = 42; 4 | } 5 | } 6 | // ---- 7 | // TypeError 6182: (74-78): Calldata arrays are read-only. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/metaTypes/codeAccessIsConstant.sol: -------------------------------------------------------------------------------- 1 | contract Test { 2 | bytes constant c = type(B).creationCode; 3 | bytes constant r = type(B).runtimeCode; 4 | 5 | } 6 | contract B { function f() public pure {} } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/061_missing_base_constructor_arguments.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor(uint a) { } } 2 | contract B is A { } 3 | // ---- 4 | // TypeError 3656: (39-58): Contract "B" should be marked as abstract. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/062_base_constructor_arguments_override.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor(uint a) { } } 2 | contract B is A { } 3 | // ---- 4 | // TypeError 3656: (39-58): Contract "B" should be marked as abstract. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/079_fallback_function_inheritance.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | uint x; 3 | fallback() virtual external { x = 1; } 4 | } 5 | contract C is A { 6 | fallback() override external { x = 2; } 7 | } 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/148_external_argument_delete.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | function f(uint a) external { delete a; } 3 | } 4 | // ---- 5 | // Warning 2018: (17-58): Function state mutability can be restricted to pure 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/366_invalid_array_as_statement.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | struct S { uint x; } 3 | constructor(uint k) { S[k]; } 4 | } 5 | // ---- 6 | // TypeError 3940: (69-70): Integer constant expected. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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/syntax/solidity/parsing/address_payable_type_expression.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | address payable; 4 | } 5 | } 6 | // ---- 7 | // ParserError 2314: (67-68): Expected identifier but got ';' 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/super/super_in_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | } 3 | function f() pure { 4 | super; 5 | } 6 | // ---- 7 | // DeclarationError 7576: (39-44): Undeclared identifier. "super" is not (or not yet) visible at this point. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/tryCatch/no_catch.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public returns (uint, uint) { 3 | try this.f() { 4 | } 5 | } 6 | } 7 | // ---- 8 | // ParserError 2314: (97-98): Expected 'catch' but got '}' 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/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 4247: (74-78): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/viewPureChecker/suggest_view.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint x; 3 | function g() public returns (uint) { return x; } 4 | } 5 | // ---- 6 | // Warning 2018: (29-77): Function state mutability can be restricted to view 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/length/cannot_be_function.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public {} 3 | uint[f] ids; 4 | } 5 | // ---- 6 | // TypeError 5462: (49-50): Invalid array length, expected integer literal or constant expression. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/slice_literal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | 1[1:]; 4 | } 5 | } 6 | // ---- 7 | // TypeError 4781: (52-57): Index range access is only possible for arrays and array slices. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/slice/slice_string.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | ""[1:]; 4 | } 5 | } 6 | // ---- 7 | // TypeError 4781: (52-58): Index range access is only possible for arrays and array slices. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/controlFlow/storageReturn/unimplemented_internal.sol: -------------------------------------------------------------------------------- 1 | abstract contract C { 2 | function f() internal virtual returns(uint[] storage); 3 | function g() internal virtual returns(uint[] storage s); 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/emit/emit_non_event.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function() Test; 3 | 4 | function f() public { 5 | emit Test(); 6 | } 7 | } 8 | // ---- 9 | // TypeError 9292: (66-70): Expression has to be an event invocation. 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/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 7249: (17-91): More than 3 indexed arguments for event. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/freeFunctions/super_in_free_function.sol: -------------------------------------------------------------------------------- 1 | contract C {} 2 | function f() { 3 | super; 4 | } 5 | // ---- 6 | // DeclarationError 7576: (33-38): Undeclared identifier. "super" is not (or not yet) visible at this point. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/globalFunctions/now_override.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public view { 3 | uint now = block.timestamp; 4 | now; 5 | } 6 | } 7 | // ---- 8 | // Warning 2319: (43-51): This declaration shadows a builtin symbol. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/globalFunctions/sha3_no_call.sol: -------------------------------------------------------------------------------- 1 | contract C 2 | { 3 | function f(bytes memory data) public pure { 4 | sha3; 5 | } 6 | } 7 | // ---- 8 | // TypeError 3557: (60-64): "sha3" has been deprecated in favour of "keccak256". 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_3.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | contract A {} 3 | ==== Source: b ==== 4 | import {A as b} from "a"; contract b {} 5 | // ---- 6 | // DeclarationError 2333: (b:26-39): Identifier already declared. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/indexing/function_type_without_index.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | f[]; 4 | } 5 | } 6 | // ---- 7 | // TypeError 2614: (41-42): Indexed expression has to be a type, mapping or array (is function ()) 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/public_var_same_name_but_different_args.sol: -------------------------------------------------------------------------------- 1 | contract A { 2 | function foo(uint) internal virtual pure returns(uint) { return 5; } 3 | } 4 | contract X is A { 5 | uint public foo; 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/override/public_vars_wrong_override.sol: -------------------------------------------------------------------------------- 1 | contract X { 2 | uint public override foo; 3 | } 4 | // ---- 5 | // TypeError 7792: (26-34): Public state variable has override specified but does not override anything. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/virtual/modifier_virtual_err.sol: -------------------------------------------------------------------------------- 1 | library test { 2 | modifier m virtual; 3 | function f() m public { 4 | } 5 | } 6 | // ---- 7 | // TypeError 3275: (19-38): Modifiers in a library cannot be virtual. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/constant_computation.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint constant x = 2**20; 3 | function f() public pure { 4 | assembly { 5 | let a := x 6 | } 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/015_balance_invalid.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function fun() public { 3 | address(0).balance = 7; 4 | } 5 | } 6 | // ---- 7 | // TypeError 4247: (52-70): Expression has to be an lvalue. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/110_no_overflow_with_large_literal.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | constructor() { 3 | a = 115792089237316195423570985008687907853269984665640564039458; 4 | } 5 | uint256 a; 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/216_function_argument_storage_to_mem.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f(uint[] storage x) private { 3 | g(x); 4 | } 5 | function g(uint[] memory x) public { 6 | } 7 | } 8 | // ---- 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/402_assignment_to_constant.sol: -------------------------------------------------------------------------------- 1 | contract c { 2 | uint constant a = 1; 3 | function f() public { a = 2; } 4 | } 5 | // ---- 6 | // TypeError 6520: (64-65): Cannot assign to a constant variable. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/416_interface_function_bodies.sol: -------------------------------------------------------------------------------- 1 | interface I { 2 | function f() external pure { 3 | } 4 | } 5 | // ---- 6 | // TypeError 4726: (18-52): Functions in interfaces cannot have an implementation. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/501_gasleft_shadowing_2.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint gasleft; 3 | function f() public { gasleft = 42; } 4 | } 5 | // ---- 6 | // Warning 2319: (17-29): This declaration shadows a builtin symbol. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/512_library_function_without_implementation_internal.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() internal; 3 | } 4 | // ---- 5 | // TypeError 9231: (16-38): Library functions must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/513_library_function_without_implementation_private.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() private; 3 | } 4 | // ---- 5 | // TypeError 9231: (16-37): Library functions must be implemented if declared. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 3390: (53-59): Invalid rational number. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/570_function_type_undeclared_type.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function a(function(Nested)) external pure {} 3 | } 4 | // ---- 5 | // DeclarationError 7920: (37-43): Identifier not found or not unique. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/typeChecking/function_call.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f() public returns (bool) { return g(12, true) == 3; } 3 | function g(uint256, bool) public returns (uint256) { } 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/parsing/constant_state_modifier.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint s; 3 | function f() public constant returns (uint) { 4 | return s; 5 | } 6 | } 7 | // ---- 8 | // ParserError 2314: (43-51): Expected '{' but got 'constant' 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/function_type_as_storage_variable_with_assignment.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | function f(uint x, uint y) public returns (uint a) {} 3 | function (uint, uint) internal returns (uint) f1 = f; 4 | } 5 | // ---- 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 7591: (45-46): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/single_modifier_arg_trailing_comma.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | modifier modTest(uint a,) { _; } 3 | function(uint a) {} 4 | } 5 | // ---- 6 | // ParserError 7591: (40-41): Unexpected trailing comma in parameter list. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/parsing/wrong_compiler_4.sol: -------------------------------------------------------------------------------- 1 | pragma solidity ^99.99.0; 2 | contract C { 3 | function f() {} 4 | } 5 | // ---- 6 | // ParserError 5333: (0-25): Source file requires different compiler version (current compiler is .... 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/array_calldata.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | struct S { int a; } 4 | function f(S[] calldata) external { } 5 | function f(S[][] calldata) external { } 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/structs/member_type_eq_name.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | struct S {t t;} 3 | function f(function(S memory) external) public {} 4 | } 5 | // ---- 6 | // TypeError 5172: (25-26): Name has to refer to a struct, enum or contract. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/super/super_in_library.sol: -------------------------------------------------------------------------------- 1 | library L { 2 | function f() public { 3 | (super); 4 | } 5 | } 6 | // ---- 7 | // DeclarationError 7576: (41-46): Undeclared identifier. "super" is not (or not yet) visible at this point. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/empty_tuple_event.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event SomeEvent(); 3 | function a() public { 4 | (emit SomeEvent(), 7); 5 | } 6 | } 7 | // ---- 8 | // ParserError 6933: (71-75): Expected primary expression. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/types/var_empty_decl_1.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | var a; 4 | a.NeverReachedByParser(); 5 | } 6 | } 7 | // ---- 8 | // ParserError 6933: (52-55): Expected primary expression. 9 | -------------------------------------------------------------------------------- /test/syntax/soliditypp/pragma/different_version.solpp: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: GPL-3.0 2 | pragma soliditypp ^100.0.0; 3 | // ---- 4 | // ParserError 5333: (36-63): Source file requires different compiler version (current compiler is .... 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/abstract/unimplemented_functions_inherited.sol: -------------------------------------------------------------------------------- 1 | abstract contract A { 2 | function a() public virtual; 3 | } 4 | contract B is A { 5 | } 6 | // ---- 7 | // TypeError 3656: (57-76): Contract "B" should be marked as abstract. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/array/calldata_assign.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | contract Test { 3 | function f(uint256[] calldata s) external { s[0] = 4; } 4 | } 5 | // ---- 6 | // TypeError 6182: (98-102): Calldata arrays are read-only. 7 | -------------------------------------------------------------------------------- /test/syntax/solidity/controlFlow/unreachableCode/double_return.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure returns (uint) { 3 | return 0; 4 | return 0; 5 | } 6 | } 7 | // ---- 8 | // Warning 5740: (85-93): Unreachable code. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/events/event_without_emit_deprecated.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | event e(); 3 | function f() public { 4 | e(); 5 | } 6 | } 7 | // ---- 8 | // TypeError 3132: (62-65): Event invocations have to be prefixed by "emit". 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/external_function_type_taking_internal.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(function () internal) external x; 3 | } 4 | // ---- 5 | // TypeError 2582: (26-47): Internal type cannot be used for external function type. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/functionTypes/function_type_return_parameters_with_names.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function(uint) returns (bool ret) f; 3 | } 4 | // ---- 5 | // SyntaxError 7304: (41-49): Return parameters in function types may not be named. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/imports/name_clash_in_import_enum_contract.sol: -------------------------------------------------------------------------------- 1 | ==== Source: a ==== 2 | enum E { A } 3 | ==== Source: b ==== 4 | import "a"; 5 | contract E { } 6 | // ---- 7 | // DeclarationError 2333: (b:12-26): Identifier already declared. 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/inheritance/duplicated_constructor_call/base.sol: -------------------------------------------------------------------------------- 1 | contract A { constructor(uint) { } } 2 | contract B is A(2) { constructor() A(3) { } } 3 | // ---- 4 | // DeclarationError 3364: (72-76): Base constructor arguments given twice. 5 | -------------------------------------------------------------------------------- /test/syntax/solidity/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 4977: (72-73): Expected a library. 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/function_call_not_found.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public pure { 3 | assembly { 4 | k() 5 | } 6 | } 7 | } 8 | // ---- 9 | // DeclarationError 4619: (63-64): Function not found. 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/inlineAssembly/invalid/constant_access.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | uint constant x = 1; 3 | function f() public pure { 4 | assembly { 5 | let y := x 6 | } 7 | } 8 | } 9 | // ---- 10 | -------------------------------------------------------------------------------- /test/syntax/solidity/multiVariableDeclaration/oneElementTuple.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | function f() public { 3 | (uint a,) = (1,); 4 | a; 5 | } 6 | } 7 | // ---- 8 | // TypeError 8381: (59-63): Tuple component cannot be empty. 9 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/047_returning_arrays_in_structs_new_abi.sol: -------------------------------------------------------------------------------- 1 | pragma abicoder v2; 2 | 3 | contract C { 4 | struct S { string[] s; } 5 | function f() public pure returns (S memory) {} 6 | } 7 | // ---- 8 | -------------------------------------------------------------------------------- /test/syntax/solidity/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/syntax/solidity/nameAndTypeResolution/133_enum_duplicate_values.sol: -------------------------------------------------------------------------------- 1 | contract test { 2 | enum ActionChoices { GoLeft, GoRight, GoLeft, Sit } 3 | } 4 | // ---- 5 | // DeclarationError 2333: (66-72): Identifier already declared. 6 | -------------------------------------------------------------------------------- /test/syntax/solidity/nameAndTypeResolution/171_assignment_to_const_array_vars.sol: -------------------------------------------------------------------------------- 1 | contract C { 2 | uint[3] constant x = [uint(1), 2, 3]; 3 | } 4 | // ---- 5 | // DeclarationError 9259: (17-53): Constants of non-value type not yet implemented. 6 | --------------------------------------------------------------------------------