mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Error when Mapping type in (non-local) storage is assigned to
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
contract D {
|
||||
mapping (uint => uint) a;
|
||||
mapping (uint => uint) b;
|
||||
function foo() public view {
|
||||
mapping (uint => uint) storage c = b;
|
||||
b = c;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (160-161): Mappings cannot be assigned to.
|
||||
@@ -0,0 +1,27 @@
|
||||
contract C {
|
||||
mapping (uint => address payable [ ]) public a = a ;
|
||||
}
|
||||
|
||||
contract D {
|
||||
mapping (uint => uint) a;
|
||||
mapping (uint => uint) b = a;
|
||||
}
|
||||
|
||||
contract F {
|
||||
mapping (uint => uint) a;
|
||||
mapping (uint => uint) b;
|
||||
|
||||
function foo() public {
|
||||
a = b;
|
||||
}
|
||||
}
|
||||
|
||||
contract G {
|
||||
uint x = 1;
|
||||
mapping (uint => uint) b = x;
|
||||
}
|
||||
// ----
|
||||
// TypeError: (17-67): Mappings cannot be assigned to.
|
||||
// TypeError: (120-148): Mappings cannot be assigned to.
|
||||
// TypeError: (263-264): Mappings cannot be assigned to.
|
||||
// TypeError: (312-340): Mappings cannot be assigned to.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract D {
|
||||
mapping (uint => uint) a;
|
||||
function foo() public view {
|
||||
mapping (uint => int) storage c = a;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (84-119): Type mapping(uint256 => uint256) is not implicitly convertible to expected type mapping(uint256 => int256).
|
||||
Reference in New Issue
Block a user