mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9428 from ethereum/removeVar
Remove special treatment of ``var``.
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
{
|
||||
"C":
|
||||
[
|
||||
8
|
||||
9
|
||||
]
|
||||
},
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
@@ -17,10 +17,10 @@
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"fullyImplemented": true,
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
8
|
||||
9
|
||||
],
|
||||
"name": "C",
|
||||
"nodeType": "ContractDefinition",
|
||||
@@ -29,48 +29,60 @@
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"nodeType": "Block",
|
||||
"src": "33:20:1",
|
||||
"src": "33:30:1",
|
||||
"statements":
|
||||
[
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
3
|
||||
4
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 3,
|
||||
"id": 4,
|
||||
"mutability": "mutable",
|
||||
"name": "x",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 6,
|
||||
"src": "35:5:1",
|
||||
"scope": 7,
|
||||
"src": "35:15:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"storageLocation": "memory",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_string_memory_ptr",
|
||||
"typeString": "string"
|
||||
},
|
||||
"typeName":
|
||||
{
|
||||
"id": 3,
|
||||
"name": "string",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "35:6:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_string_storage_ptr",
|
||||
"typeString": "string"
|
||||
}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 5,
|
||||
"id": 6,
|
||||
"initialValue":
|
||||
{
|
||||
"hexValue": "ff",
|
||||
"id": 4,
|
||||
"id": 5,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "string",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "43:7:1",
|
||||
"src": "53:7:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_stringliteral_8b1a944cf13a9a1c08facb2c9e98623ef3254d2ddb48113885c3e8e97fec8db9",
|
||||
@@ -78,12 +90,12 @@
|
||||
}
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "35:15:1"
|
||||
"src": "35:25:1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functionSelector": "26121ff0",
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
@@ -103,16 +115,16 @@
|
||||
"parameters": [],
|
||||
"src": "33:0:1"
|
||||
},
|
||||
"scope": 8,
|
||||
"src": "13:40:1",
|
||||
"scope": 9,
|
||||
"src": "13:50:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 9,
|
||||
"src": "0:55:1"
|
||||
"scope": 10,
|
||||
"src": "0:65:1"
|
||||
}
|
||||
],
|
||||
"src": "0:56:1"
|
||||
"src": "0:66:1"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
contract C { function f() public { var x = hex"ff"; } }
|
||||
contract C { function f() public { string memory x = hex"ff"; } }
|
||||
|
||||
// ----
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"C":
|
||||
[
|
||||
8
|
||||
9
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -28,10 +28,10 @@
|
||||
"fullyImplemented": true,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
8
|
||||
9
|
||||
],
|
||||
"name": "C",
|
||||
"scope": 9
|
||||
"scope": 10
|
||||
},
|
||||
"children":
|
||||
[
|
||||
@@ -47,7 +47,7 @@
|
||||
null
|
||||
],
|
||||
"name": "f",
|
||||
"scope": 8,
|
||||
"scope": 9,
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
@@ -88,7 +88,7 @@
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
3
|
||||
4
|
||||
]
|
||||
},
|
||||
"children":
|
||||
@@ -99,16 +99,28 @@
|
||||
"constant": false,
|
||||
"mutability": "mutable",
|
||||
"name": "x",
|
||||
"scope": 6,
|
||||
"scope": 7,
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"storageLocation": "memory",
|
||||
"type": "string",
|
||||
"visibility": "internal"
|
||||
},
|
||||
"children": [],
|
||||
"id": 3,
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"name": "string",
|
||||
"type": "string"
|
||||
},
|
||||
"id": 3,
|
||||
"name": "ElementaryTypeName",
|
||||
"src": "35:6:1"
|
||||
}
|
||||
],
|
||||
"id": 4,
|
||||
"name": "VariableDeclaration",
|
||||
"src": "35:5:1"
|
||||
"src": "35:15:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
@@ -121,32 +133,32 @@
|
||||
"token": "string",
|
||||
"type": "literal_string (contains invalid UTF-8 sequence at position 0)"
|
||||
},
|
||||
"id": 4,
|
||||
"id": 5,
|
||||
"name": "Literal",
|
||||
"src": "43:7:1"
|
||||
"src": "53:7:1"
|
||||
}
|
||||
],
|
||||
"id": 5,
|
||||
"id": 6,
|
||||
"name": "VariableDeclarationStatement",
|
||||
"src": "35:15:1"
|
||||
"src": "35:25:1"
|
||||
}
|
||||
],
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"name": "Block",
|
||||
"src": "33:20:1"
|
||||
"src": "33:30:1"
|
||||
}
|
||||
],
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"name": "FunctionDefinition",
|
||||
"src": "13:40:1"
|
||||
"src": "13:50:1"
|
||||
}
|
||||
],
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"name": "ContractDefinition",
|
||||
"src": "0:55:1"
|
||||
"src": "0:65:1"
|
||||
}
|
||||
],
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"name": "SourceUnit",
|
||||
"src": "0:56:1"
|
||||
"src": "0:66:1"
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
{
|
||||
"C":
|
||||
[
|
||||
11
|
||||
12
|
||||
]
|
||||
},
|
||||
"id": 12,
|
||||
"id": 13,
|
||||
"nodeType": "SourceUnit",
|
||||
"nodes":
|
||||
[
|
||||
@@ -17,10 +17,10 @@
|
||||
"contractDependencies": [],
|
||||
"contractKind": "contract",
|
||||
"fullyImplemented": true,
|
||||
"id": 11,
|
||||
"id": 12,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
11
|
||||
12
|
||||
],
|
||||
"name": "C",
|
||||
"nodeType": "ContractDefinition",
|
||||
@@ -29,48 +29,60 @@
|
||||
{
|
||||
"body":
|
||||
{
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"nodeType": "Block",
|
||||
"src": "26:19:1",
|
||||
"src": "26:20:1",
|
||||
"statements":
|
||||
[
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
3
|
||||
4
|
||||
],
|
||||
"declarations":
|
||||
[
|
||||
{
|
||||
"constant": false,
|
||||
"id": 3,
|
||||
"id": 4,
|
||||
"mutability": "mutable",
|
||||
"name": "x",
|
||||
"nodeType": "VariableDeclaration",
|
||||
"scope": 9,
|
||||
"src": "28:5:1",
|
||||
"scope": 10,
|
||||
"src": "28:6:1",
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint8",
|
||||
"typeString": "uint8"
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
},
|
||||
"typeName":
|
||||
{
|
||||
"id": 3,
|
||||
"name": "uint",
|
||||
"nodeType": "ElementaryTypeName",
|
||||
"src": "28:4:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"visibility": "internal"
|
||||
}
|
||||
],
|
||||
"id": 5,
|
||||
"id": 6,
|
||||
"initialValue":
|
||||
{
|
||||
"hexValue": "32",
|
||||
"id": 4,
|
||||
"id": 5,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": true,
|
||||
"kind": "number",
|
||||
"lValueRequested": false,
|
||||
"nodeType": "Literal",
|
||||
"src": "36:1:1",
|
||||
"src": "37:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_rational_2_by_1",
|
||||
@@ -79,12 +91,12 @@
|
||||
"value": "2"
|
||||
},
|
||||
"nodeType": "VariableDeclarationStatement",
|
||||
"src": "28:9:1"
|
||||
"src": "28:10:1"
|
||||
},
|
||||
{
|
||||
"expression":
|
||||
{
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"isConstant": false,
|
||||
"isLValue": false,
|
||||
"isPure": false,
|
||||
@@ -92,35 +104,35 @@
|
||||
"nodeType": "UnaryOperation",
|
||||
"operator": "++",
|
||||
"prefix": false,
|
||||
"src": "39:3:1",
|
||||
"src": "40:3:1",
|
||||
"subExpression":
|
||||
{
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"name": "x",
|
||||
"nodeType": "Identifier",
|
||||
"overloadedDeclarations": [],
|
||||
"referencedDeclaration": 3,
|
||||
"src": "39:1:1",
|
||||
"referencedDeclaration": 4,
|
||||
"src": "40:1:1",
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint8",
|
||||
"typeString": "uint8"
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"typeDescriptions":
|
||||
{
|
||||
"typeIdentifier": "t_uint8",
|
||||
"typeString": "uint8"
|
||||
"typeIdentifier": "t_uint256",
|
||||
"typeString": "uint256"
|
||||
}
|
||||
},
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"nodeType": "ExpressionStatement",
|
||||
"src": "39:3:1"
|
||||
"src": "40:3:1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"functionSelector": "26121ff0",
|
||||
"id": 10,
|
||||
"id": 11,
|
||||
"implemented": true,
|
||||
"kind": "function",
|
||||
"modifiers": [],
|
||||
@@ -140,16 +152,16 @@
|
||||
"parameters": [],
|
||||
"src": "26:0:1"
|
||||
},
|
||||
"scope": 11,
|
||||
"src": "13:32:1",
|
||||
"scope": 12,
|
||||
"src": "13:33:1",
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
}
|
||||
],
|
||||
"scope": 12,
|
||||
"src": "0:47:1"
|
||||
"scope": 13,
|
||||
"src": "0:48:1"
|
||||
}
|
||||
],
|
||||
"src": "0:48:1"
|
||||
"src": "0:49:1"
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
contract C { function f() { var x = 2; x++; } }
|
||||
contract C { function f() { uint x = 2; x++; } }
|
||||
|
||||
// ----
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
"C":
|
||||
[
|
||||
11
|
||||
12
|
||||
]
|
||||
}
|
||||
},
|
||||
@@ -28,10 +28,10 @@
|
||||
"fullyImplemented": true,
|
||||
"linearizedBaseContracts":
|
||||
[
|
||||
11
|
||||
12
|
||||
],
|
||||
"name": "C",
|
||||
"scope": 12
|
||||
"scope": 13
|
||||
},
|
||||
"children":
|
||||
[
|
||||
@@ -47,7 +47,7 @@
|
||||
null
|
||||
],
|
||||
"name": "f",
|
||||
"scope": 11,
|
||||
"scope": 12,
|
||||
"stateMutability": "nonpayable",
|
||||
"virtual": false,
|
||||
"visibility": "public"
|
||||
@@ -88,7 +88,7 @@
|
||||
{
|
||||
"assignments":
|
||||
[
|
||||
3
|
||||
4
|
||||
]
|
||||
},
|
||||
"children":
|
||||
@@ -99,16 +99,28 @@
|
||||
"constant": false,
|
||||
"mutability": "mutable",
|
||||
"name": "x",
|
||||
"scope": 9,
|
||||
"scope": 10,
|
||||
"stateVariable": false,
|
||||
"storageLocation": "default",
|
||||
"type": "uint8",
|
||||
"type": "uint256",
|
||||
"visibility": "internal"
|
||||
},
|
||||
"children": [],
|
||||
"id": 3,
|
||||
"children":
|
||||
[
|
||||
{
|
||||
"attributes":
|
||||
{
|
||||
"name": "uint",
|
||||
"type": "uint256"
|
||||
},
|
||||
"id": 3,
|
||||
"name": "ElementaryTypeName",
|
||||
"src": "28:4:1"
|
||||
}
|
||||
],
|
||||
"id": 4,
|
||||
"name": "VariableDeclaration",
|
||||
"src": "28:5:1"
|
||||
"src": "28:6:1"
|
||||
},
|
||||
{
|
||||
"attributes":
|
||||
@@ -122,14 +134,14 @@
|
||||
"type": "int_const 2",
|
||||
"value": "2"
|
||||
},
|
||||
"id": 4,
|
||||
"id": 5,
|
||||
"name": "Literal",
|
||||
"src": "36:1:1"
|
||||
"src": "37:1:1"
|
||||
}
|
||||
],
|
||||
"id": 5,
|
||||
"id": 6,
|
||||
"name": "VariableDeclarationStatement",
|
||||
"src": "28:9:1"
|
||||
"src": "28:10:1"
|
||||
},
|
||||
{
|
||||
"children":
|
||||
@@ -143,7 +155,7 @@
|
||||
"lValueRequested": false,
|
||||
"operator": "++",
|
||||
"prefix": false,
|
||||
"type": "uint8"
|
||||
"type": "uint256"
|
||||
},
|
||||
"children":
|
||||
[
|
||||
@@ -154,41 +166,41 @@
|
||||
[
|
||||
null
|
||||
],
|
||||
"referencedDeclaration": 3,
|
||||
"type": "uint8",
|
||||
"referencedDeclaration": 4,
|
||||
"type": "uint256",
|
||||
"value": "x"
|
||||
},
|
||||
"id": 6,
|
||||
"id": 7,
|
||||
"name": "Identifier",
|
||||
"src": "39:1:1"
|
||||
"src": "40:1:1"
|
||||
}
|
||||
],
|
||||
"id": 7,
|
||||
"id": 8,
|
||||
"name": "UnaryOperation",
|
||||
"src": "39:3:1"
|
||||
"src": "40:3:1"
|
||||
}
|
||||
],
|
||||
"id": 8,
|
||||
"id": 9,
|
||||
"name": "ExpressionStatement",
|
||||
"src": "39:3:1"
|
||||
"src": "40:3:1"
|
||||
}
|
||||
],
|
||||
"id": 9,
|
||||
"id": 10,
|
||||
"name": "Block",
|
||||
"src": "26:19:1"
|
||||
"src": "26:20:1"
|
||||
}
|
||||
],
|
||||
"id": 10,
|
||||
"id": 11,
|
||||
"name": "FunctionDefinition",
|
||||
"src": "13:32:1"
|
||||
"src": "13:33:1"
|
||||
}
|
||||
],
|
||||
"id": 11,
|
||||
"id": 12,
|
||||
"name": "ContractDefinition",
|
||||
"src": "0:47:1"
|
||||
"src": "0:48:1"
|
||||
}
|
||||
],
|
||||
"id": 12,
|
||||
"id": 13,
|
||||
"name": "SourceUnit",
|
||||
"src": "0:48:1"
|
||||
"src": "0:49:1"
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body)
|
||||
contract test {
|
||||
/// fun1 description
|
||||
function fun1(uint256 a) {
|
||||
var b;
|
||||
uint b;
|
||||
// I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore)
|
||||
uint256 c;
|
||||
mapping(address=>bytes32) d;
|
||||
@@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature)
|
||||
uint256 stateVar;
|
||||
function ///I am in the wrong place
|
||||
fun1(uint256 a) {
|
||||
var b;
|
||||
uint b;
|
||||
// I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore)
|
||||
uint256 c;
|
||||
mapping(address=>bytes32) d;
|
||||
@@ -311,7 +311,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature)
|
||||
uint256 stateVar;
|
||||
function fun1(uint256 a) {
|
||||
// I should have been above the function signature (natspec comments on local variables not allowed anymore)
|
||||
var b;
|
||||
uint b;
|
||||
// I should not interfere with actual natspec comments (natspec comments on local variables not allowed anymore)
|
||||
uint256 c;
|
||||
mapping(address=>bytes32) d;
|
||||
@@ -334,7 +334,7 @@ BOOST_AUTO_TEST_CASE(variable_definition)
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function fun(uint256 a) {
|
||||
var b;
|
||||
uint b;
|
||||
uint256 c;
|
||||
mapping(address=>bytes32) d;
|
||||
customtype varname;
|
||||
@@ -349,7 +349,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization)
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function fun(uint256 a) {
|
||||
var b = 2;
|
||||
uint b = 2;
|
||||
uint256 c = 0x87;
|
||||
mapping(address=>bytes32) d;
|
||||
bytes7 name = "Solidity";
|
||||
@@ -403,7 +403,7 @@ BOOST_AUTO_TEST_CASE(type_conversion_to_dynamic_array)
|
||||
char const* text = R"(
|
||||
contract test {
|
||||
function fun() {
|
||||
var x = uint64[](3);
|
||||
uint x = uint64[](3);
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
contract C
|
||||
{
|
||||
function f ( ) public {
|
||||
var i = ( ( 1 ( 3 ) ) , 2 );
|
||||
( ( 1 ( 3 ) ) , 2 );
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 5704: (61-68): Type is not callable
|
||||
// TypeError 5704: (53-60): Type is not callable
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (91-136): Data location must be "storage" for variable, but "memory" was given.
|
||||
// TypeError 4061: (91-136): Type mapping(string => uint24)[1] is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -4,12 +4,11 @@ contract b {
|
||||
}
|
||||
|
||||
c d;
|
||||
function e() public {
|
||||
var d = d;
|
||||
function e() public view {
|
||||
c storage x = d;
|
||||
x.a[0];
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 2519: (105-110): This declaration shadows an existing declaration.
|
||||
// Warning 3408: (66-69): Variable "d" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// Warning 2332: (105-110): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
// SyntaxError 1719: (105-114): Use of the "var" keyword is disallowed. Use explicit declaration `struct b.c storage pointer d = ...´ instead.
|
||||
// Warning 2332: (110-111): Type "b.c" covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction.
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (47-77): Data location must be "storage" for variable, but "memory" was given.
|
||||
// TypeError 4061: (47-77): Type mapping(uint256 => uint256)[] is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
+2
-2
@@ -2,8 +2,8 @@ contract C {
|
||||
struct S { uint a; uint b; mapping(uint=>uint) c; }
|
||||
|
||||
function f() public {
|
||||
S memory s = S({a: 1});
|
||||
S({a: 1});
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 9515: (117-126): Struct containing a (nested) mapping cannot be constructed.
|
||||
// TypeError 9515: (104-113): Struct containing a (nested) mapping cannot be constructed.
|
||||
|
||||
@@ -2,4 +2,4 @@ contract Foo {
|
||||
function f() { var memory x; }
|
||||
}
|
||||
// ----
|
||||
// ParserError 7439: (35-41): Location specifier needs explicit type name.
|
||||
// ParserError 6933: (31-34): Expected primary expression.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 7059: (35-38): Expected explicit type name.
|
||||
// ParserError 3546: (35-38): Expected type name
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
contract C {
|
||||
function f() returns(var) {}
|
||||
function f() returns(var x) {}
|
||||
function f() returns(var x, uint y) {}
|
||||
function f() returns(uint x, var y) {}
|
||||
function f() returns(var x, var y) {}
|
||||
function f() public pure returns (var storage) {}
|
||||
function f() public pure returns (var storage x) {}
|
||||
function f() public pure returns (var storage x, var storage y) {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 7059: (38-41): Expected explicit type name.
|
||||
// ParserError 7059: (71-74): Expected explicit type name.
|
||||
// ParserError 7059: (106-109): Expected explicit type name.
|
||||
// ParserError 7059: (157-160): Expected explicit type name.
|
||||
// ParserError 7059: (192-195): Expected explicit type name.
|
||||
// ParserError 7059: (199-202): Expected explicit type name.
|
||||
// ParserError 7059: (247-250): Expected explicit type name.
|
||||
// ParserError 7439: (251-258): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (301-304): Expected explicit type name.
|
||||
// ParserError 7439: (305-312): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (357-360): Expected explicit type name.
|
||||
// ParserError 7439: (361-368): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (372-375): Expected explicit type name.
|
||||
// ParserError 7439: (376-383): Location specifier needs explicit type name.
|
||||
@@ -1,7 +1,7 @@
|
||||
contract C {
|
||||
function f() {
|
||||
var a = (2 2);
|
||||
uint a = (2 2);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (42-43): Expected ',' but got 'Number'
|
||||
// ParserError 2314: (43-44): Expected ',' but got 'Number'
|
||||
|
||||
@@ -2,4 +2,4 @@ contract Foo {
|
||||
function f() { var[] a; }
|
||||
}
|
||||
// ----
|
||||
// ParserError 2314: (34-35): Expected identifier but got '['
|
||||
// ParserError 6933: (31-34): Expected primary expression.
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
contract C {
|
||||
function f(var) public pure {}
|
||||
function f(var x) public pure {}
|
||||
function f(var x, var y) public pure {}
|
||||
function f(uint x, var y) public pure {}
|
||||
function f(var x, uint y) public pure {}
|
||||
function f(var storage) public pure {}
|
||||
function f(var storage x) public pure {}
|
||||
function f(var storage x, var storage y) public pure {}
|
||||
}
|
||||
// ----
|
||||
// ParserError 7059: (28-31): Expected explicit type name.
|
||||
// ParserError 7059: (63-66): Expected explicit type name.
|
||||
// ParserError 7059: (100-103): Expected explicit type name.
|
||||
// ParserError 7059: (107-110): Expected explicit type name.
|
||||
// ParserError 7059: (152-155): Expected explicit type name.
|
||||
// ParserError 7059: (189-192): Expected explicit type name.
|
||||
// ParserError 7059: (234-237): Expected explicit type name.
|
||||
// ParserError 7439: (238-245): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (277-280): Expected explicit type name.
|
||||
// ParserError 7439: (281-288): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (322-325): Expected explicit type name.
|
||||
// ParserError 7439: (326-333): Location specifier needs explicit type name.
|
||||
// ParserError 7059: (337-340): Expected explicit type name.
|
||||
// ParserError 7439: (341-348): Location specifier needs explicit type name.
|
||||
@@ -1,7 +0,0 @@
|
||||
contract C {
|
||||
struct S {
|
||||
var x;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// ParserError 7059: (27-30): Expected explicit type name.
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (81-113): Data location must be "storage" for variable, but "calldata" was given.
|
||||
// TypeError 4061: (81-113): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (81-104): Data location must be "storage" for variable, but none was given.
|
||||
// TypeError 6651: (81-104): Data location must be "storage", "memory" or "calldata" for variable, but none was given.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract c {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6651: (81-111): Data location must be "storage" for variable, but "memory" was given.
|
||||
// TypeError 4061: (81-111): Type mapping(uint256 => uint256) is only valid in storage because it contains a (nested) mapping.
|
||||
|
||||
@@ -4,13 +4,11 @@ contract C {
|
||||
function h() internal pure returns (uint, uint) { return (1, 2); }
|
||||
|
||||
function test() internal pure {
|
||||
var () = f();
|
||||
var () = g();
|
||||
var (,) = h();
|
||||
() = f();
|
||||
() = g();
|
||||
(,) = h();
|
||||
}
|
||||
}
|
||||
|
||||
// ----
|
||||
// SyntaxError 3299: (223-235): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
|
||||
// SyntaxError 3299: (245-257): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
|
||||
// SyntaxError 3299: (267-280): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
|
||||
// ParserError 6933: (224-225): Expected primary expression.
|
||||
|
||||
@@ -3,13 +3,14 @@ contract n
|
||||
fallback() external
|
||||
{
|
||||
// Used to cause a segfault
|
||||
var (x,y) = (1);
|
||||
var (z) = ();
|
||||
(uint x, ) = (1);
|
||||
(uint z) = ();
|
||||
|
||||
assembly {
|
||||
mstore(y, z)
|
||||
mstore(x, z)
|
||||
}
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 7364: (69-84): Different number of components on the left hand side (2) than on the right hand side (1).
|
||||
// TypeError 7364: (69-85): Different number of components on the left hand side (2) than on the right hand side (1).
|
||||
// TypeError 7364: (89-102): Different number of components on the left hand side (1) than on the right hand side (0).
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
contract C {
|
||||
function f() public pure {
|
||||
var ();
|
||||
var (,);
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 3299: (52-58): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
|
||||
// SyntaxError 3299: (68-75): The use of the "var" keyword is disallowed. The declaration part of the statement can be removed, since it is empty.
|
||||
@@ -5,4 +5,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6983: (52-57): Use of the "var" keyword is disallowed.
|
||||
// ParserError 6933: (52-55): Expected primary expression.
|
||||
|
||||
@@ -6,4 +6,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4626: (52-62): Use of the "var" keyword is disallowed.
|
||||
// ParserError 6933: (52-55): Expected primary expression.
|
||||
|
||||
@@ -4,4 +4,4 @@ contract C {
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 4626: (52-63): Use of the "var" keyword is disallowed.
|
||||
// ParserError 6933: (52-55): Expected primary expression.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
contract C {
|
||||
function f() internal pure {
|
||||
var i = 31415999999999999999999999999999999999999999999999999999999999999999933**3;
|
||||
var unreachable = 123;
|
||||
uint i = 31415999999999999999999999999999999999999999999999999999999999999999933**3;
|
||||
uint unreachable = 123;
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// TypeError 6963: (62-136): Invalid rational int_const 3100...(204 digits omitted)...9237 (absolute value too large or division by zero).
|
||||
// TypeError 9574: (54-137): Type int_const 3100...(204 digits omitted)...9237 is not implicitly convertible to expected type uint256. Literal is too large to fit in uint256.
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
contract C {
|
||||
function h() internal pure returns (uint, uint, uint) {
|
||||
return (1, 2, 4);
|
||||
}
|
||||
function g(uint x) internal pure returns (uint) {
|
||||
return x;
|
||||
}
|
||||
function f() internal pure {
|
||||
var s = -31415;
|
||||
var i = 31415;
|
||||
var t = "string";
|
||||
var g2 = g;
|
||||
var myblockhash = block.blockhash;
|
||||
var (a, b) = (2, "troi");
|
||||
var (x,, z) = h();
|
||||
var (c, d) = ("");
|
||||
var (k, l) = (2);
|
||||
var (m, n) = 1;
|
||||
var (o, p) = "";
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// SyntaxError 1719: (224-238): Use of the "var" keyword is disallowed. Use explicit declaration `int16 s = ...´ instead.
|
||||
// SyntaxError 1719: (248-261): Use of the "var" keyword is disallowed. Use explicit declaration `uint16 i = ...´ instead.
|
||||
// SyntaxError 1719: (271-287): Use of the "var" keyword is disallowed. Use explicit declaration `string memory t = ...´ instead.
|
||||
// SyntaxError 1719: (297-307): Use of the "var" keyword is disallowed. Use explicit declaration `function (uint256) pure returns (uint256) g2 = ...´ instead.
|
||||
// SyntaxError 3478: (317-350): Use of the "var" keyword is disallowed. Type cannot be expressed in syntax.
|
||||
// SyntaxError 1719: (360-384): Use of the "var" keyword is disallowed. Use explicit declaration `(uint8 a, string memory b) = ...´ instead.
|
||||
// SyntaxError 1719: (394-411): Use of the "var" keyword is disallowed. Use explicit declaration `(uint256 x, , uint256 z) = ...´ instead.
|
||||
// TypeError 7364: (421-438): Different number of components on the left hand side (2) than on the right hand side (1).
|
||||
Reference in New Issue
Block a user