diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments.sol new file mode 100644 index 000000000..2432d7e73 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments.sol @@ -0,0 +1,30 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C() {} +contract E is C() { constructor() {} } +contract F is C() { constructor() C {} } +contract G is C() { constructor() C() {} } + +contract H is C {} +contract I is C { constructor() {} } +contract J is C { constructor() C {} } +contract K is C { constructor() C() {} } +// ---- +// TypeError 3656: (47-67): Contract "D" should be marked as abstract. +// TypeError 3656: (68-106): Contract "E" should be marked as abstract. +// DeclarationError 1563: (141-142): Modifier-style base constructor call without arguments. +// TypeError 3656: (107-147): Contract "F" should be marked as abstract. +// TypeError 3656: (192-210): Contract "H" should be marked as abstract. +// TypeError 3656: (211-247): Contract "I" should be marked as abstract. +// DeclarationError 1563: (280-281): Modifier-style base constructor call without arguments. +// TypeError 3656: (248-286): Contract "J" should be marked as abstract. +// TypeError 7927: (61-64): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (82-85): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (121-124): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (141-142): Wrong argument count for modifier invocation: 0 arguments given but expected 2. +// TypeError 7927: (162-165): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (182-185): Wrong argument count for modifier invocation: 0 arguments given but expected 2. +// TypeError 2973: (280-281): Wrong argument count for modifier invocation: 0 arguments given but expected 2. +// TypeError 2973: (319-322): Wrong argument count for modifier invocation: 0 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_inheritance_list_empty_parens.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_inheritance_list_empty_parens.sol new file mode 100644 index 000000000..42ba9886f --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_inheritance_list_empty_parens.sol @@ -0,0 +1,16 @@ +abstract contract C { + constructor(uint, bool) {} +} + +abstract contract D is C() {} +abstract contract E is C() { constructor() {} } +abstract contract F is C() { constructor() C {} } +abstract contract G is C() { constructor() C() {} } +// ---- +// DeclarationError 1563: (177-178): Modifier-style base constructor call without arguments. +// TypeError 7927: (79-82): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (109-112): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (157-160): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (177-178): Wrong argument count for modifier invocation: 0 arguments given but expected 2. +// TypeError 7927: (207-210): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (227-230): Wrong argument count for modifier invocation: 0 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_lists_omitted.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_lists_omitted.sol new file mode 100644 index 000000000..ad934d7e7 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_lists_omitted.sol @@ -0,0 +1,6 @@ +abstract contract C { + constructor(uint, bool) {} +} + +abstract contract D is C {} +abstract contract E is C { constructor() {} } diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init.sol new file mode 100644 index 000000000..7cf33c0ec --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init.sol @@ -0,0 +1,8 @@ +abstract contract C { + constructor(uint, bool) {} +} + +abstract contract D is C { constructor() C {} } +// ---- +// DeclarationError 1563: (97-98): Modifier-style base constructor call without arguments. +// TypeError 2973: (97-98): Wrong argument count for modifier invocation: 0 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init_empty_list.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init_empty_list.sol new file mode 100644 index 000000000..43c68a7ee --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_missing_arguments_abstract_modifier_init_empty_list.sol @@ -0,0 +1,7 @@ +abstract contract C { + constructor(uint, bool) {} +} + +abstract contract D is C { constructor() C() {} } +// ---- +// TypeError 2973: (97-100): Wrong argument count for modifier invocation: 0 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_and_modifier_lists.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_and_modifier_lists.sol new file mode 100644 index 000000000..290afd91b --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_and_modifier_lists.sol @@ -0,0 +1,13 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C(1, true, "a") { constructor() C(1, true, "a") {} } +contract E is C(1) { constructor() C(1) {} } +// ---- +// DeclarationError 3364: (93-108): Base constructor arguments given twice. +// DeclarationError 3364: (149-153): Base constructor arguments given twice. +// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (93-108): Wrong argument count for modifier invocation: 3 arguments given but expected 2. +// TypeError 7927: (128-132): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (149-153): Wrong argument count for modifier invocation: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list.sol new file mode 100644 index 000000000..2a933e3f0 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list.sol @@ -0,0 +1,9 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C(1, true, "a") {} +contract E is C(1) {} +// ---- +// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (94-98): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_abstract.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_abstract.sol new file mode 100644 index 000000000..4974cdbc1 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_abstract.sol @@ -0,0 +1,9 @@ +abstract contract C { + constructor(uint, bool) {} +} + +abstract contract D is C(1, true, "a") {} +abstract contract E is C(1) {} +// ---- +// TypeError 7927: (79-94): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (121-125): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_empty_parens_and_modifier_list.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_empty_parens_and_modifier_list.sol new file mode 100644 index 000000000..5bf9d1239 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_empty_parens_and_modifier_list.sol @@ -0,0 +1,11 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C() { constructor() C(1, true, "a") {} } +contract E is C() { constructor() C(1) {} } +// ---- +// TypeError 7927: (61-64): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (81-96): Wrong argument count for modifier invocation: 3 arguments given but expected 2. +// TypeError 7927: (116-119): Wrong argument count for constructor call: 0 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 2973: (136-140): Wrong argument count for modifier invocation: 1 arguments given but expected 2. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_with_derived_constructor.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_with_derived_constructor.sol new file mode 100644 index 000000000..02113c04b --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_inheritance_list_with_derived_constructor.sol @@ -0,0 +1,9 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C(1, true, "a") { constructor() {} } +contract E is C(1) { constructor() {} } +// ---- +// TypeError 7927: (61-76): Wrong argument count for constructor call: 3 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. +// TypeError 7927: (112-116): Wrong argument count for constructor call: 1 arguments given but expected 2. Remove parentheses if you do not want to provide arguments here. diff --git a/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_modifier_list.sol b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_modifier_list.sol new file mode 100644 index 000000000..8fe486e16 --- /dev/null +++ b/test/libsolidity/syntaxTests/constructor/base_constructor_wrong_arg_count_modifier_list.sol @@ -0,0 +1,9 @@ +contract C { + constructor(uint, bool) {} +} + +contract D is C { constructor() C(1, true, "a") {} } +contract E is C { constructor() C(1) {} } +// ---- +// TypeError 2973: (79-94): Wrong argument count for modifier invocation: 3 arguments given but expected 2. +// TypeError 2973: (132-136): Wrong argument count for modifier invocation: 1 arguments given but expected 2.