mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests, Changelog and updated grammar
This commit is contained in:
parent
e2e32d372f
commit
48ff9fd4d6
@ -2,6 +2,7 @@
|
||||
|
||||
Language Features:
|
||||
* Add support for EIP 165 interface identifiers with `type(I).interfaceId`.
|
||||
* Allow virtual modifiers inside abstract contracts to have empty body.
|
||||
|
||||
|
||||
Compiler Features:
|
||||
|
@ -68,7 +68,7 @@ structDefinition
|
||||
'{' ( variableDeclaration ';' (variableDeclaration ';')* )? '}' ;
|
||||
|
||||
modifierDefinition
|
||||
: 'modifier' identifier parameterList? ( VirtualKeyword | overrideSpecifier )* block ;
|
||||
: 'modifier' identifier parameterList? ( VirtualKeyword | overrideSpecifier )* ( ';' | block ) ;
|
||||
|
||||
functionDefinition
|
||||
: functionDescriptor parameterList modifierList returnParameters? ( ';' | block ) ;
|
||||
|
@ -0,0 +1,17 @@
|
||||
abstract contract A {
|
||||
function f() public mod returns (bool r) {
|
||||
return true;
|
||||
}
|
||||
|
||||
modifier mod virtual;
|
||||
}
|
||||
|
||||
|
||||
contract C is A {
|
||||
modifier mod override {
|
||||
if (false) _;
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// f() -> false
|
@ -0,0 +1,14 @@
|
||||
abstract contract A { modifier mod(uint a) virtual;}
|
||||
contract B is A { modifier mod(uint a) override { _; } }
|
||||
|
||||
abstract contract C {
|
||||
modifier m virtual;
|
||||
function f() m public {
|
||||
|
||||
}
|
||||
}
|
||||
contract D is C {
|
||||
modifier m override {
|
||||
_;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
contract A {modifier m virtual;}
|
||||
|
||||
abstract contract B {modifier m virtual;}
|
||||
contract C is B { }
|
||||
|
||||
abstract contract D {modifier m;}
|
||||
// ----
|
||||
// TypeError: (0-32): Contract "A" should be marked as abstract.
|
||||
// TypeError: (76-95): Contract "C" should be marked as abstract.
|
||||
// TypeError: (118-129): Modifiers without implementation must be marked virtual.
|
@ -0,0 +1,31 @@
|
||||
abstract contract A {
|
||||
function foo() public virtual;
|
||||
function foo(uint x) virtual public returns(uint);
|
||||
modifier mod() virtual;
|
||||
}
|
||||
|
||||
contract B is A {
|
||||
function foo(uint x) override public returns(uint) {return x;}
|
||||
modifier mod() override { _; }
|
||||
}
|
||||
|
||||
contract C is A {
|
||||
function foo() public override {}
|
||||
modifier mod() override { _; }
|
||||
}
|
||||
|
||||
contract D is A {
|
||||
function foo() public override {}
|
||||
function foo(uint x) override public returns(uint) {return x;}
|
||||
}
|
||||
|
||||
/* No errors */
|
||||
contract E is A {
|
||||
function foo() public override {}
|
||||
function foo(uint x) override public returns(uint) {return x;}
|
||||
modifier mod() override { _;}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (137-254): Contract "B" should be marked as abstract.
|
||||
// TypeError: (256-344): Contract "C" should be marked as abstract.
|
||||
// TypeError: (346-466): Contract "D" should be marked as abstract.
|
Loading…
Reference in New Issue
Block a user