diff --git a/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol b/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol new file mode 100644 index 000000000..6f1932ffb --- /dev/null +++ b/test/libsolidity/syntaxTests/inheritance/reference_non_base_ctor.sol @@ -0,0 +1,6 @@ +contract X {} +contract D { + constructor() X(5) public {} +} +// ---- +// TypeError: (45-49): Referenced declaration is neither modifier nor base class. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol index 536dd317c..d1f91a237 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/396_invalid_mobile_type.sol @@ -1,8 +1,10 @@ contract C { function f() public { // Invalid number + 78901234567890123456789012345678901234567890123456789345678901234567890012345678012345678901234567; [1, 78901234567890123456789012345678901234567890123456789345678901234567890012345678012345678901234567]; } } // ---- -// TypeError: (93-191): Invalid rational number. +// TypeError: (89-187): Invalid rational number. +// TypeError: (205-303): Invalid rational number. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol new file mode 100644 index 000000000..f2ad3f563 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/585_abi_decode_with_unsupported_types.sol @@ -0,0 +1,8 @@ +contract C { + struct s { uint a; uint b; } + function f() pure public { + abi.decode("", (s)); + } +} +// ---- +// TypeError: (98-99): Decoding type struct C.s memory not supported. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/586_invalid_types_for_constructor_call.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/586_invalid_types_for_constructor_call.sol new file mode 100644 index 000000000..b1416ddec --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/586_invalid_types_for_constructor_call.sol @@ -0,0 +1,12 @@ +contract C { + constructor(bytes32 _arg) public { + } +} + +contract A { + function f() public { + new C((1234)); + } +} +// ---- +// TypeError: (115-121): Invalid type for argument in function call. Invalid implicit conversion from int_const 1234 to bytes32 requested. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol new file mode 100644 index 000000000..c076017a8 --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/587_event_param_type_outside_storage.sol @@ -0,0 +1,7 @@ +contract c { + event e(uint indexed a, mapping(uint => uint) indexed b, bool indexed c, uint indexed d, uint indexed e) anonymous; +} +// ---- +// TypeError: (41-72): Type is required to live outside storage. +// TypeError: (41-72): Internal or recursive type is not allowed as event parameter type. +// TypeError: (17-132): More than 4 indexed arguments for anonymous event. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/588_inline_assembly_two_stack_slots.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/588_inline_assembly_two_stack_slots.sol new file mode 100644 index 000000000..c7084a0ee --- /dev/null +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/588_inline_assembly_two_stack_slots.sol @@ -0,0 +1,10 @@ +contract C { + function f() pure external { + function() external two_stack_slots; + assembly { + let x := two_stack_slots + } + } +} +// ---- +// TypeError: (132-147): Only types that use one stack slot are supported. diff --git a/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol new file mode 100644 index 000000000..0a9b993ee --- /dev/null +++ b/test/libsolidity/syntaxTests/returnExpressions/single_return_mismatching_type.sol @@ -0,0 +1,9 @@ +contract C +{ + function g() public pure returns (uint) + { + return "string"; + } +} +// ---- +// TypeError: (78-86): Return argument type literal_string "string" is not implicitly convertible to expected type (type of first return variable) uint256. diff --git a/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol new file mode 100644 index 000000000..e418390c5 --- /dev/null +++ b/test/libsolidity/syntaxTests/specialFunctions/abidecode/abi_decode_invalid_arg_type.sol @@ -0,0 +1,8 @@ +contract C { + function f() public pure { + abi.decode(uint, uint); + } +} +// ---- +// TypeError: (57-61): Invalid type for argument in function call. Invalid implicit conversion from type(uint256) to bytes memory requested. +// TypeError: (63-67): The second argument to "abi.decode" has to be a tuple of types.