mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4911 from ethereum/addressPayable
Payable and non-payable address type.
This commit is contained in:
@@ -0,0 +1,560 @@
|
||||
{
|
||||
"absolutePath" : "a",
|
||||
"exportedSymbols" :
|
||||
{
|
||||
"C" :
|
||||
[
|
||||
37
|
||||
]
|
||||
},
|
||||
"id" : 38,
|
||||
"nodeType" : "SourceUnit",
|
||||
"nodes" :
|
||||
[
|
||||
{
|
||||
"baseContracts" : [],
|
||||
"contractDependencies" : [],
|
||||
"contractKind" : "contract",
|
||||
"documentation" : null,
|
||||
"fullyImplemented" : true,
|
||||
"id" : 37,
|
||||
"linearizedBaseContracts" :
|
||||
[
|
||||
37
|
||||
],
|
||||
"name" : "C",
|
||||
"nodeType" : "ContractDefinition",
|
||||
"nodes" :
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"id" : 4,
|
||||
"name" : "m",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 37,
|
||||
"src" : "17:44:1",
|
||||
"stateVariable" : true,
|
||||
"storageLocation" : "default",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_mapping$_t_address_$_t_address_payable_$",
|
||||
"typeString" : "mapping(address => address payable)"
|
||||
},
|
||||
"typeName" :
|
||||
{
|
||||
"id" : 3,
|
||||
"keyType" :
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "25:7:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address",
|
||||
"typeString" : "address"
|
||||
}
|
||||
},
|
||||
"nodeType" : "Mapping",
|
||||
"src" : "17:35:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_mapping$_t_address_$_t_address_payable_$",
|
||||
"typeString" : "mapping(address => address payable)"
|
||||
},
|
||||
"valueType" :
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "36:15:1",
|
||||
"stateMutability" : "payable",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
}
|
||||
},
|
||||
"value" : null,
|
||||
"visibility" : "public"
|
||||
},
|
||||
{
|
||||
"body" :
|
||||
{
|
||||
"id" : 35,
|
||||
"nodeType" : "Block",
|
||||
"src" : "134:122:1",
|
||||
"statements" :
|
||||
[
|
||||
{
|
||||
"assignments" :
|
||||
[
|
||||
12
|
||||
],
|
||||
"declarations" :
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"id" : 12,
|
||||
"name" : "a",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 35,
|
||||
"src" : "144:17:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
},
|
||||
"typeName" :
|
||||
{
|
||||
"id" : 11,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "144:15:1",
|
||||
"stateMutability" : "payable",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
}
|
||||
],
|
||||
"id" : 16,
|
||||
"initialValue" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"baseExpression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 13,
|
||||
"name" : "m",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 4,
|
||||
"src" : "164:1:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_mapping$_t_address_$_t_address_payable_$",
|
||||
"typeString" : "mapping(address => address payable)"
|
||||
}
|
||||
},
|
||||
"id" : 15,
|
||||
"indexExpression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 14,
|
||||
"name" : "arg",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 6,
|
||||
"src" : "166:3:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"isConstant" : false,
|
||||
"isLValue" : true,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"nodeType" : "IndexAccess",
|
||||
"src" : "164:6:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"nodeType" : "VariableDeclarationStatement",
|
||||
"src" : "144:26:1"
|
||||
},
|
||||
{
|
||||
"expression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 19,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"leftHandSide" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 17,
|
||||
"name" : "r",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 9,
|
||||
"src" : "180:1:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"nodeType" : "Assignment",
|
||||
"operator" : "=",
|
||||
"rightHandSide" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 18,
|
||||
"name" : "arg",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 6,
|
||||
"src" : "184:3:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"src" : "180:7:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"id" : 20,
|
||||
"nodeType" : "ExpressionStatement",
|
||||
"src" : "180:7:1"
|
||||
},
|
||||
{
|
||||
"assignments" :
|
||||
[
|
||||
22
|
||||
],
|
||||
"declarations" :
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"id" : 22,
|
||||
"name" : "c",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 35,
|
||||
"src" : "197:9:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address",
|
||||
"typeString" : "address"
|
||||
},
|
||||
"typeName" :
|
||||
{
|
||||
"id" : 21,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "197:7:1",
|
||||
"stateMutability" : "nonpayable",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address",
|
||||
"typeString" : "address"
|
||||
}
|
||||
},
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
}
|
||||
],
|
||||
"id" : 26,
|
||||
"initialValue" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"arguments" :
|
||||
[
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 24,
|
||||
"name" : "this",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 65,
|
||||
"src" : "217:4:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_contract$_C_$37",
|
||||
"typeString" : "contract C"
|
||||
}
|
||||
}
|
||||
],
|
||||
"expression" :
|
||||
{
|
||||
"argumentTypes" :
|
||||
[
|
||||
{
|
||||
"typeIdentifier" : "t_contract$_C_$37",
|
||||
"typeString" : "contract C"
|
||||
}
|
||||
],
|
||||
"id" : 23,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"lValueRequested" : false,
|
||||
"nodeType" : "ElementaryTypeNameExpression",
|
||||
"src" : "209:7:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_type$_t_address_$",
|
||||
"typeString" : "type(address)"
|
||||
},
|
||||
"typeName" : "address"
|
||||
},
|
||||
"id" : 25,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"kind" : "typeConversion",
|
||||
"lValueRequested" : false,
|
||||
"names" : [],
|
||||
"nodeType" : "FunctionCall",
|
||||
"src" : "209:13:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address",
|
||||
"typeString" : "address"
|
||||
}
|
||||
},
|
||||
"nodeType" : "VariableDeclarationStatement",
|
||||
"src" : "197:25:1"
|
||||
},
|
||||
{
|
||||
"expression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 33,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"leftHandSide" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"baseExpression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 27,
|
||||
"name" : "m",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 4,
|
||||
"src" : "232:1:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_mapping$_t_address_$_t_address_payable_$",
|
||||
"typeString" : "mapping(address => address payable)"
|
||||
}
|
||||
},
|
||||
"id" : 29,
|
||||
"indexExpression" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"id" : 28,
|
||||
"name" : "c",
|
||||
"nodeType" : "Identifier",
|
||||
"overloadedDeclarations" : [],
|
||||
"referencedDeclaration" : 22,
|
||||
"src" : "234:1:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address",
|
||||
"typeString" : "address"
|
||||
}
|
||||
},
|
||||
"isConstant" : false,
|
||||
"isLValue" : true,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : true,
|
||||
"nodeType" : "IndexAccess",
|
||||
"src" : "232:4:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"nodeType" : "Assignment",
|
||||
"operator" : "=",
|
||||
"rightHandSide" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"arguments" :
|
||||
[
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"hexValue" : "30",
|
||||
"id" : 31,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"kind" : "number",
|
||||
"lValueRequested" : false,
|
||||
"nodeType" : "Literal",
|
||||
"src" : "247:1:1",
|
||||
"subdenomination" : null,
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_rational_0_by_1",
|
||||
"typeString" : "int_const 0"
|
||||
},
|
||||
"value" : "0"
|
||||
}
|
||||
],
|
||||
"expression" :
|
||||
{
|
||||
"argumentTypes" :
|
||||
[
|
||||
{
|
||||
"typeIdentifier" : "t_rational_0_by_1",
|
||||
"typeString" : "int_const 0"
|
||||
}
|
||||
],
|
||||
"id" : 30,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"lValueRequested" : false,
|
||||
"nodeType" : "ElementaryTypeNameExpression",
|
||||
"src" : "239:7:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_type$_t_address_$",
|
||||
"typeString" : "type(address)"
|
||||
},
|
||||
"typeName" : "address"
|
||||
},
|
||||
"id" : 32,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"kind" : "typeConversion",
|
||||
"lValueRequested" : false,
|
||||
"names" : [],
|
||||
"nodeType" : "FunctionCall",
|
||||
"src" : "239:10:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"src" : "232:17:1",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"id" : 34,
|
||||
"nodeType" : "ExpressionStatement",
|
||||
"src" : "232:17:1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"documentation" : null,
|
||||
"id" : 36,
|
||||
"implemented" : true,
|
||||
"isConstructor" : false,
|
||||
"modifiers" : [],
|
||||
"name" : "f",
|
||||
"nodeType" : "FunctionDefinition",
|
||||
"parameters" :
|
||||
{
|
||||
"id" : 7,
|
||||
"nodeType" : "ParameterList",
|
||||
"parameters" :
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"id" : 6,
|
||||
"name" : "arg",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 36,
|
||||
"src" : "78:19:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
},
|
||||
"typeName" :
|
||||
{
|
||||
"id" : 5,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "78:15:1",
|
||||
"stateMutability" : "payable",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
}
|
||||
],
|
||||
"src" : "77:21:1"
|
||||
},
|
||||
"returnParameters" :
|
||||
{
|
||||
"id" : 10,
|
||||
"nodeType" : "ParameterList",
|
||||
"parameters" :
|
||||
[
|
||||
{
|
||||
"constant" : false,
|
||||
"id" : 9,
|
||||
"name" : "r",
|
||||
"nodeType" : "VariableDeclaration",
|
||||
"scope" : 36,
|
||||
"src" : "115:17:1",
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
},
|
||||
"typeName" :
|
||||
{
|
||||
"id" : 8,
|
||||
"name" : "address",
|
||||
"nodeType" : "ElementaryTypeName",
|
||||
"src" : "115:15:1",
|
||||
"stateMutability" : "payable",
|
||||
"typeDescriptions" :
|
||||
{
|
||||
"typeIdentifier" : "t_address_payable",
|
||||
"typeString" : "address payable"
|
||||
}
|
||||
},
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
}
|
||||
],
|
||||
"src" : "114:19:1"
|
||||
},
|
||||
"scope" : 37,
|
||||
"src" : "67:189:1",
|
||||
"stateMutability" : "nonpayable",
|
||||
"superFunction" : null,
|
||||
"visibility" : "public"
|
||||
}
|
||||
],
|
||||
"scope" : 38,
|
||||
"src" : "0:258:1"
|
||||
}
|
||||
],
|
||||
"src" : "0:259:1"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
mapping(address => address payable) public m;
|
||||
function f(address payable arg) public returns (address payable r) {
|
||||
address payable a = m[arg];
|
||||
r = arg;
|
||||
address c = address(this);
|
||||
m[c] = address(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
@@ -0,0 +1,600 @@
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"absolutePath" : "a",
|
||||
"exportedSymbols" :
|
||||
{
|
||||
"C" :
|
||||
[
|
||||
37
|
||||
]
|
||||
}
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"baseContracts" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractDependencies" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"contractKind" : "contract",
|
||||
"documentation" : null,
|
||||
"fullyImplemented" : true,
|
||||
"linearizedBaseContracts" :
|
||||
[
|
||||
37
|
||||
],
|
||||
"name" : "C",
|
||||
"scope" : 38
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "m",
|
||||
"scope" : 37,
|
||||
"stateVariable" : true,
|
||||
"storageLocation" : "default",
|
||||
"type" : "mapping(address => address payable)",
|
||||
"value" : null,
|
||||
"visibility" : "public"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"type" : "mapping(address => address payable)"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"type" : "address"
|
||||
},
|
||||
"id" : 1,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "25:7:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"stateMutability" : "payable",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"id" : 2,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "36:15:1"
|
||||
}
|
||||
],
|
||||
"id" : 3,
|
||||
"name" : "Mapping",
|
||||
"src" : "17:35:1"
|
||||
}
|
||||
],
|
||||
"id" : 4,
|
||||
"name" : "VariableDeclaration",
|
||||
"src" : "17:44:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"documentation" : null,
|
||||
"implemented" : true,
|
||||
"isConstructor" : false,
|
||||
"modifiers" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"name" : "f",
|
||||
"scope" : 37,
|
||||
"stateMutability" : "nonpayable",
|
||||
"superFunction" : null,
|
||||
"visibility" : "public"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "arg",
|
||||
"scope" : 36,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "address payable",
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"stateMutability" : "payable",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"id" : 5,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "78:15:1"
|
||||
}
|
||||
],
|
||||
"id" : 6,
|
||||
"name" : "VariableDeclaration",
|
||||
"src" : "78:19:1"
|
||||
}
|
||||
],
|
||||
"id" : 7,
|
||||
"name" : "ParameterList",
|
||||
"src" : "77:21:1"
|
||||
},
|
||||
{
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "r",
|
||||
"scope" : 36,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "address payable",
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"stateMutability" : "payable",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"id" : 8,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "115:15:1"
|
||||
}
|
||||
],
|
||||
"id" : 9,
|
||||
"name" : "VariableDeclaration",
|
||||
"src" : "115:17:1"
|
||||
}
|
||||
],
|
||||
"id" : 10,
|
||||
"name" : "ParameterList",
|
||||
"src" : "114:19:1"
|
||||
},
|
||||
{
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"assignments" :
|
||||
[
|
||||
12
|
||||
]
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "a",
|
||||
"scope" : 35,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "address payable",
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"stateMutability" : "payable",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"id" : 11,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "144:15:1"
|
||||
}
|
||||
],
|
||||
"id" : 12,
|
||||
"name" : "VariableDeclaration",
|
||||
"src" : "144:17:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : true,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"type" : "address payable"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 4,
|
||||
"type" : "mapping(address => address payable)",
|
||||
"value" : "m"
|
||||
},
|
||||
"id" : 13,
|
||||
"name" : "Identifier",
|
||||
"src" : "164:1:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 6,
|
||||
"type" : "address payable",
|
||||
"value" : "arg"
|
||||
},
|
||||
"id" : 14,
|
||||
"name" : "Identifier",
|
||||
"src" : "166:3:1"
|
||||
}
|
||||
],
|
||||
"id" : 15,
|
||||
"name" : "IndexAccess",
|
||||
"src" : "164:6:1"
|
||||
}
|
||||
],
|
||||
"id" : 16,
|
||||
"name" : "VariableDeclarationStatement",
|
||||
"src" : "144:26:1"
|
||||
},
|
||||
{
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"operator" : "=",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 9,
|
||||
"type" : "address payable",
|
||||
"value" : "r"
|
||||
},
|
||||
"id" : 17,
|
||||
"name" : "Identifier",
|
||||
"src" : "180:1:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 6,
|
||||
"type" : "address payable",
|
||||
"value" : "arg"
|
||||
},
|
||||
"id" : 18,
|
||||
"name" : "Identifier",
|
||||
"src" : "184:3:1"
|
||||
}
|
||||
],
|
||||
"id" : 19,
|
||||
"name" : "Assignment",
|
||||
"src" : "180:7:1"
|
||||
}
|
||||
],
|
||||
"id" : 20,
|
||||
"name" : "ExpressionStatement",
|
||||
"src" : "180:7:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"assignments" :
|
||||
[
|
||||
22
|
||||
]
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"constant" : false,
|
||||
"name" : "c",
|
||||
"scope" : 35,
|
||||
"stateVariable" : false,
|
||||
"storageLocation" : "default",
|
||||
"type" : "address",
|
||||
"value" : null,
|
||||
"visibility" : "internal"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"name" : "address",
|
||||
"stateMutability" : "nonpayable",
|
||||
"type" : "address"
|
||||
},
|
||||
"id" : 21,
|
||||
"name" : "ElementaryTypeName",
|
||||
"src" : "197:7:1"
|
||||
}
|
||||
],
|
||||
"id" : 22,
|
||||
"name" : "VariableDeclaration",
|
||||
"src" : "197:9:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"isStructConstructorCall" : false,
|
||||
"lValueRequested" : false,
|
||||
"names" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"type" : "address",
|
||||
"type_conversion" : true
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" :
|
||||
[
|
||||
{
|
||||
"typeIdentifier" : "t_contract$_C_$37",
|
||||
"typeString" : "contract C"
|
||||
}
|
||||
],
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"lValueRequested" : false,
|
||||
"type" : "type(address)",
|
||||
"value" : "address"
|
||||
},
|
||||
"id" : 23,
|
||||
"name" : "ElementaryTypeNameExpression",
|
||||
"src" : "209:7:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 65,
|
||||
"type" : "contract C",
|
||||
"value" : "this"
|
||||
},
|
||||
"id" : 24,
|
||||
"name" : "Identifier",
|
||||
"src" : "217:4:1"
|
||||
}
|
||||
],
|
||||
"id" : 25,
|
||||
"name" : "FunctionCall",
|
||||
"src" : "209:13:1"
|
||||
}
|
||||
],
|
||||
"id" : 26,
|
||||
"name" : "VariableDeclarationStatement",
|
||||
"src" : "197:25:1"
|
||||
},
|
||||
{
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : false,
|
||||
"operator" : "=",
|
||||
"type" : "address payable"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : true,
|
||||
"isPure" : false,
|
||||
"lValueRequested" : true,
|
||||
"type" : "address payable"
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 4,
|
||||
"type" : "mapping(address => address payable)",
|
||||
"value" : "m"
|
||||
},
|
||||
"id" : 27,
|
||||
"name" : "Identifier",
|
||||
"src" : "232:1:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"overloadedDeclarations" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration" : 22,
|
||||
"type" : "address",
|
||||
"value" : "c"
|
||||
},
|
||||
"id" : 28,
|
||||
"name" : "Identifier",
|
||||
"src" : "234:1:1"
|
||||
}
|
||||
],
|
||||
"id" : 29,
|
||||
"name" : "IndexAccess",
|
||||
"src" : "232:4:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"isStructConstructorCall" : false,
|
||||
"lValueRequested" : false,
|
||||
"names" :
|
||||
[
|
||||
null
|
||||
],
|
||||
"type" : "address payable",
|
||||
"type_conversion" : true
|
||||
},
|
||||
"children" :
|
||||
[
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" :
|
||||
[
|
||||
{
|
||||
"typeIdentifier" : "t_rational_0_by_1",
|
||||
"typeString" : "int_const 0"
|
||||
}
|
||||
],
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"lValueRequested" : false,
|
||||
"type" : "type(address)",
|
||||
"value" : "address"
|
||||
},
|
||||
"id" : 30,
|
||||
"name" : "ElementaryTypeNameExpression",
|
||||
"src" : "239:7:1"
|
||||
},
|
||||
{
|
||||
"attributes" :
|
||||
{
|
||||
"argumentTypes" : null,
|
||||
"hexvalue" : "30",
|
||||
"isConstant" : false,
|
||||
"isLValue" : false,
|
||||
"isPure" : true,
|
||||
"lValueRequested" : false,
|
||||
"subdenomination" : null,
|
||||
"token" : "number",
|
||||
"type" : "int_const 0",
|
||||
"value" : "0"
|
||||
},
|
||||
"id" : 31,
|
||||
"name" : "Literal",
|
||||
"src" : "247:1:1"
|
||||
}
|
||||
],
|
||||
"id" : 32,
|
||||
"name" : "FunctionCall",
|
||||
"src" : "239:10:1"
|
||||
}
|
||||
],
|
||||
"id" : 33,
|
||||
"name" : "Assignment",
|
||||
"src" : "232:17:1"
|
||||
}
|
||||
],
|
||||
"id" : 34,
|
||||
"name" : "ExpressionStatement",
|
||||
"src" : "232:17:1"
|
||||
}
|
||||
],
|
||||
"id" : 35,
|
||||
"name" : "Block",
|
||||
"src" : "134:122:1"
|
||||
}
|
||||
],
|
||||
"id" : 36,
|
||||
"name" : "FunctionDefinition",
|
||||
"src" : "67:189:1"
|
||||
}
|
||||
],
|
||||
"id" : 37,
|
||||
"name" : "ContractDefinition",
|
||||
"src" : "0:258:1"
|
||||
}
|
||||
],
|
||||
"id" : 38,
|
||||
"name" : "SourceUnit",
|
||||
"src" : "0:259:1"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
struct S {
|
||||
address payable a;
|
||||
address b;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
address a;
|
||||
function f(address b) public pure returns (address c) {
|
||||
address d = b;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
address payable a;
|
||||
function f(address payable b) public pure returns (address payable c) {
|
||||
address payable d = b;
|
||||
return d;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f(bytes memory b) public pure returns (address payable) {
|
||||
(address payable c) = abi.decode(b, (address));
|
||||
return c;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
address constant a = address(0);
|
||||
address payable constant b = address(0);
|
||||
function f() public pure returns (address, address) {
|
||||
return (a,b);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
address constant a = address(0);
|
||||
address payable constant b = address(0);
|
||||
function f() public {
|
||||
a = address(0);
|
||||
b = address(0);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (129-130): Cannot assign to a constant variable.
|
||||
// TypeError: (153-154): Cannot assign to a constant variable.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract A {
|
||||
struct S {
|
||||
address payable a;
|
||||
}
|
||||
S s;
|
||||
function f() public {
|
||||
s.a = address(this);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (110-123): Type address is not implicitly convertible to expected type address payable.
|
||||
@@ -0,0 +1,20 @@
|
||||
contract A {
|
||||
struct S {
|
||||
address a;
|
||||
}
|
||||
S s;
|
||||
function f() public {
|
||||
s.a = address(this);
|
||||
}
|
||||
}
|
||||
contract B {
|
||||
struct S {
|
||||
address payable a;
|
||||
}
|
||||
S s;
|
||||
function f() public {
|
||||
s.a = address(this);
|
||||
}
|
||||
function() external payable {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(address a) public {
|
||||
selfdestruct(a);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (69-70): Invalid type for argument in function call. Invalid implicit conversion from address to address payable requested.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(address) external pure {}
|
||||
function f(address payable) external pure {}
|
||||
|
||||
}
|
||||
// ----
|
||||
// TypeError: (58-102): Function overload clash during conversion to external types for arguments.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f(address payable) internal pure {}
|
||||
function f(address) internal pure returns (uint) {}
|
||||
function g() internal pure {
|
||||
address a = address(0);
|
||||
uint b = f(a); // TODO: should this be valid?
|
||||
b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f(address payable) internal pure {}
|
||||
function f(address) internal pure {}
|
||||
function g() internal pure {
|
||||
address payable a = address(0);
|
||||
f(a);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (184-185): No unique declaration found after argument-dependent lookup.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
address payable[] memory a = new address payable[](4);
|
||||
address[] memory b = new address[](4);
|
||||
a = b;
|
||||
b = a;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (166-167): Type address[] memory is not implicitly convertible to expected type address payable[] memory.
|
||||
// TypeError: (181-182): Type address payable[] memory is not implicitly convertible to expected type address[] memory.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(address) public pure {}
|
||||
function f(address payable) public pure {}
|
||||
|
||||
}
|
||||
// ----
|
||||
// TypeError: (56-98): Function overload clash during conversion to external types for arguments.
|
||||
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
function f(address payable a) public {
|
||||
selfdestruct(a);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
address payable[] a;
|
||||
address[] b;
|
||||
function f() public view {
|
||||
address payable[] storage c = a;
|
||||
address[] storage d = b;
|
||||
d = c; // TODO: this could be allowed in the future
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (172-173): Type address payable[] storage pointer is not implicitly convertible to expected type address[] storage pointer.
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
address payable[] a;
|
||||
address[] b;
|
||||
function f() public view {
|
||||
address payable[] storage c = a;
|
||||
address[] storage d = b;
|
||||
c = d;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (172-173): Type address[] storage pointer is not implicitly convertible to expected type address payable[] storage pointer.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
C c = address(2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-62): Type address payable is not implicitly convertible to expected type contract C.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure returns (C c) {
|
||||
c = C(address(2));
|
||||
}
|
||||
function() external payable {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f(address a) public pure {
|
||||
address b;
|
||||
address payable c = a;
|
||||
c = b;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (80-101): Type address is not implicitly convertible to expected type address payable.
|
||||
// TypeError: (115-116): Type address is not implicitly convertible to expected type address payable.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public view returns (address payable a, address b) {
|
||||
(address c, address payable d) = (address(this), address(0));
|
||||
(a,b) = (c,d);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (169-174): Type tuple(address,address payable) is not implicitly convertible to expected type tuple(address payable,address).
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
function f() public view returns (address payable a, address b) {
|
||||
(address c, address payable d) = (address(this), address(0));
|
||||
(a,b) = (d,c);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
address payable a = address(this);
|
||||
a;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-79): Type address is not implicitly convertible to expected type address payable.
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
address payable a = address(this);
|
||||
a;
|
||||
}
|
||||
function() external {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-79): Type address is not implicitly convertible to expected type address payable.
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
address payable a = address(this);
|
||||
a;
|
||||
}
|
||||
function() external payable {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
address payable a = this;
|
||||
a;
|
||||
}
|
||||
function() external payable {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-70): Type contract C is not implicitly convertible to expected type address payable.
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
address a = address(0);
|
||||
a = address(1);
|
||||
address b = 0x0123456789012345678901234567890123456789;
|
||||
b = 0x9876543210987654321098765432109876543210;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
address payable a = address(0);
|
||||
a = address(1);
|
||||
address payable b = 0x0123456789012345678901234567890123456789;
|
||||
b = 0x9876543210987654321098765432109876543210;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
function f() public pure returns (C c) {
|
||||
address a = address(2);
|
||||
c = C(a);
|
||||
}
|
||||
function() external payable {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (92-96): Explicit type conversion not allowed from non-payable "address" to "contract C", which has a payable fallback function.
|
||||
@@ -0,0 +1,7 @@
|
||||
contract C {
|
||||
function f(address payable a) public pure {
|
||||
address payable b;
|
||||
address c = a;
|
||||
c = b;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
contract C {
|
||||
function f() public view {
|
||||
C c = address(2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError: (46-62): Type address is not implicitly convertible to expected type contract C.
|
||||
Reference in New Issue
Block a user