mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Some changes to "abstract".
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
interface B { }
|
||||
abstract interface A { }
|
||||
// ----
|
||||
// TypeError: (0-24): Only contracts can be abstract.
|
||||
// TypeError: (16-40): Interfaces do not need the "abstract" keyword, they are abstract implicitly.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
abstract library A { }
|
||||
// ----
|
||||
// TypeError: (0-22): Only contracts can be abstract.
|
||||
// TypeError: (0-22): Libraries cannot be abstract.
|
||||
|
||||
@@ -12,4 +12,4 @@ contract Parent {
|
||||
contract Child is Parent {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (146-155): Cannot instantiate an abstract contract.
|
||||
// TypeError: (233-261): Contract "Child" should be marked as abstract.
|
||||
|
||||
@@ -9,4 +9,5 @@ contract B is A {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (131-301): Contract "B" should be marked as abstract.
|
||||
// TypeError: (250-254): Explicit type conversion not allowed from "string memory" to "contract A".
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
// This used to work pre-0.6.0.
|
||||
library L {
|
||||
function f() public returns(uint[] storage);
|
||||
function g() public returns(uint[] storage s);
|
||||
}
|
||||
abstract library T {
|
||||
function f() public returns(uint[] storage);
|
||||
function g() public returns(uint[] storage s);
|
||||
}
|
||||
// ----
|
||||
// TypeError: (146-268): Libraries cannot be abstract.
|
||||
// TypeError: (48-92): Library functions must be implemented if declared.
|
||||
// TypeError: (97-143): Library functions must be implemented if declared.
|
||||
// TypeError: (171-215): Library functions must be implemented if declared.
|
||||
// TypeError: (220-266): Library functions must be implemented if declared.
|
||||
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
library test {
|
||||
function f(bytes calldata) external;
|
||||
function f(bytes calldata) external {}
|
||||
}
|
||||
// ----
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
library test {
|
||||
function f(bytes memory) external;
|
||||
function f(bytes memory) external {}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (30-42): Data location must be "storage" or "calldata" for parameter in external function, but "memory" was given.
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
library test {
|
||||
function f(bytes storage) external;
|
||||
function f(bytes storage) external {}
|
||||
}
|
||||
|
||||
@@ -5,4 +5,3 @@ contract derived {
|
||||
}
|
||||
// ----
|
||||
// TypeError: (0-40): Contract "base" should be marked as abstract.
|
||||
// TypeError: (104-112): Cannot instantiate an abstract contract.
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
contract A { constructor(uint a) public { } }
|
||||
contract B is A { }
|
||||
// ----
|
||||
// TypeError: (46-65): Contract "B" should be marked as abstract.
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
contract A { constructor(uint a) public { } }
|
||||
contract B is A { }
|
||||
// ----
|
||||
// TypeError: (46-65): Contract "B" should be marked as abstract.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// This used to work in pre-0.6.0.
|
||||
library Lib {
|
||||
function min(uint, uint) public returns (uint);
|
||||
}
|
||||
@@ -7,4 +8,4 @@ contract Test {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning: (118-124): Unused local variable.
|
||||
// TypeError: (53-100): Library functions must be implemented if declared.
|
||||
|
||||
+3
@@ -1,4 +1,7 @@
|
||||
// This used to work pre-0.6.0.
|
||||
library L {
|
||||
// This can be used as an "interface", hence it is allowed.
|
||||
function f() public;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (112-132): Library functions must be implemented if declared.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ library L {
|
||||
function f() internal;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (16-38): Internal library function must be implemented if declared.
|
||||
// TypeError: (16-38): Library functions must be implemented if declared.
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@ library L {
|
||||
function f() private;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (16-37): Internal library function must be implemented if declared.
|
||||
// TypeError: (16-37): Library functions must be implemented if declared.
|
||||
|
||||
Reference in New Issue
Block a user