Add more tests tests for calls to base constructor with missing or wrong arguments

This commit is contained in:
Kamil Śliwak 2023-02-13 20:14:49 +01:00
parent 16bc4c6b5f
commit bc3cbfa18d
11 changed files with 127 additions and 0 deletions

View File

@ -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.

View File

@ -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.

View File

@ -0,0 +1,6 @@
abstract contract C {
constructor(uint, bool) {}
}
abstract contract D is C {}
abstract contract E is C { constructor() {} }

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.

View File

@ -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.