Merge pull request #4331 from ethereum/v050-var-keyword-preparations-soltests

Adapt soltest suite to use explicit types over "var" keyword
This commit is contained in:
chriseth 2018-06-26 12:07:19 +02:00 committed by GitHub
commit 24f124f849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 119 additions and 339 deletions

View File

@ -1,11 +0,0 @@
contract C {
function f() {
var a = "";
bytes1 b = bytes1(a);
bytes memory c = bytes(a);
string memory d = string(a);
}
}
// ----
// Warning: (34-39): Use of the "var" keyword is deprecated.
// TypeError: (61-70): Explicit type conversion not allowed from "string memory" to "bytes1".

View File

@ -3,15 +3,13 @@ contract C {
function(uint) internal returns (uint) y;
function f() public {
delete x;
var a = y;
function(uint) internal returns (uint) a = y;
delete a;
delete y;
var c = f;
function() internal c = f;
delete c;
function(uint) internal returns (uint) g;
delete g;
}
}
// ----
// Warning: (157-162): Use of the "var" keyword is deprecated.
// Warning: (212-217): Use of the "var" keyword is deprecated.

View File

@ -1,8 +0,0 @@
contract C {
function f() internal returns (uint, uint, uint, uint) {
var (uint a, uint b,,) = f();
a; b;
}
}
// ----
// ParserError: (81-85): Expected identifier but got 'uint'

View File

@ -1,8 +0,0 @@
contract test {
function f(uint256 arg1, uint32 arg2) public returns (bool ret) {
var x = arg1 + arg2 == 8; ret = x;
}
}
// ----
// Warning: (94-99): Use of the "var" keyword is deprecated.
// Warning: (20-134): Function state mutability can be restricted to pure

View File

@ -1,6 +0,0 @@
contract test {
function f() public returns (int256 r) { var x = int256(uint32(2)); return x; }
}
// ----
// Warning: (61-66): Use of the "var" keyword is deprecated.
// Warning: (20-99): Function state mutability can be restricted to pure

View File

@ -1,7 +1,6 @@
contract test {
function f() public { var x = "123456789012345678901234567890123"; }
function f() public { string memory x = "123456789012345678901234567890123"; }
}
// ----
// Warning: (42-47): Use of the "var" keyword is deprecated.
// Warning: (42-47): Unused local variable.
// Warning: (20-88): Function state mutability can be restricted to pure
// Warning: (42-57): Unused local variable.
// Warning: (20-98): Function state mutability can be restricted to pure

View File

@ -4,10 +4,9 @@ contract test {
}
str data;
function fun() public {
var a = data.map;
mapping(uint=>uint) a = data.map;
data.map = a;
}
}
// ----
// Warning: (122-127): Use of the "var" keyword is deprecated.
// TypeError: (148-160): Mappings cannot be assigned to.
// TypeError: (164-176): Mappings cannot be assigned to.

View File

@ -4,9 +4,8 @@ contract test {
}
str data;
function fun() public {
var a = data;
str storage a = data;
data = a;
}
}
// ----
// Warning: (122-127): Use of the "var" keyword is deprecated.

View File

@ -1,10 +1,9 @@
contract C {
mapping(uint => uint) x;
function f() public returns (bool ret) {
var y = x;
mapping(uint => uint) y = x;
return x == y;
}
}
// ----
// Warning: (95-100): Use of the "var" keyword is deprecated.
// TypeError: (121-127): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256)
// TypeError: (139-145): Operator == not compatible with types mapping(uint256 => uint256) and mapping(uint256 => uint256)

View File

@ -1,7 +0,0 @@
contract c {
function f() public { var (x) = f(); }
}
// ----
// Warning: (44-45): Use of the "var" keyword is deprecated.
// Warning: (39-52): Different number of components on the left hand side (1) than on the right hand side (0).
// TypeError: (39-52): Not enough components (0) in value to assign all variables (1).

View File

@ -1,9 +0,0 @@
contract test {
function f() pure public returns (uint) {
var i = 1;
return i;
}
}
// ----
// Warning: (70-75): Use of the "var" keyword is deprecated.
// Warning: (70-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.

View File

@ -1,9 +0,0 @@
contract test {
function f() pure public {
var i = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
i;
}
}
// ----
// Warning: (55-60): Use of the "var" keyword is deprecated.
// Warning: (55-129): The type of this variable was inferred as uint256, which can hold values between 0 and 115792089237316195423570985008687907853269984665640564039457584007913129639935. This is probably not desired. Use an explicit type to silence this warning.

View File

@ -1,9 +0,0 @@
contract test {
function f() pure public {
var i = -2;
i;
}
}
// ----
// Warning: (55-60): Use of the "var" keyword is deprecated.
// Warning: (55-65): The type of this variable was inferred as int8, which can hold values between -128 and 127. This is probably not desired. Use an explicit type to silence this warning.

View File

@ -1,8 +0,0 @@
contract test {
function f() pure public {
for (var i = 0; i < msg.data.length; i++) { }
}
}
// ----
// Warning: (63-68): Use of the "var" keyword is deprecated.
// Warning: (63-72): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.

View File

@ -1,7 +1,6 @@
contract test {
function f(uint a) public returns (uint) { return 2 * a; }
function g() public returns (uint) { var x = f; return x(7); }
function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); }
}
// ----
// Warning: (120-125): Use of the "var" keyword is deprecated.
// Warning: (20-78): Function state mutability can be restricted to pure

View File

@ -1,8 +1,7 @@
contract test {
function f() public returns (uint) { return 1; }
function f(uint a) public returns (uint) { return 2 * a; }
function g() public returns (uint) { var x = f; return x(7); }
function g() public returns (uint) { function (uint) returns (uint) x = f; return x(7); }
}
// ----
// Warning: (173-178): Use of the "var" keyword is deprecated.
// TypeError: (181-182): No matching declaration found after variable lookup.
// TypeError: (208-209): No matching declaration found after variable lookup.

View File

@ -1,6 +0,0 @@
contract C {
function f() public returns (uint) { var x; return 2; }
}
// ----
// Warning: (54-59): Use of the "var" keyword is deprecated.
// TypeError: (54-59): Assignment necessary for type detection.

View File

@ -1,7 +1,6 @@
contract C {
string s;
function f() public { var a = s[2]; }
function f() public { bytes1 a = s[2]; }
}
// ----
// Warning: (53-58): Use of the "var" keyword is deprecated.
// TypeError: (61-65): Index access for string is not possible.
// TypeError: (64-68): Index access for string is not possible.

View File

@ -1,7 +1,6 @@
contract C {
string s;
function f() public { var a = s.length; }
function f() public { uint a = s.length; }
}
// ----
// Warning: (53-58): Use of the "var" keyword is deprecated.
// TypeError: (61-69): Member "length" not found or not visible after argument-dependent lookup in string storage ref
// TypeError: (62-70): Member "length" not found or not visible after argument-dependent lookup in string storage ref

View File

@ -1,10 +1,9 @@
contract C {
uint[] data;
function f(uint[] x) public {
var dataRef = data;
uint[] storage dataRef = data;
dataRef = x;
}
}
// ----
// Warning: (72-83): Use of the "var" keyword is deprecated.
// TypeError: (110-111): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer.
// TypeError: (121-122): Type uint256[] memory is not implicitly convertible to expected type uint256[] storage pointer.

View File

@ -1,10 +1,9 @@
contract C {
uint[] data;
function f() public {
var x = data;
uint[] storage x = data;
delete x;
}
}
// ----
// Warning: (64-69): Use of the "var" keyword is deprecated.
// TypeError: (86-94): Unary operator delete cannot be applied to type uint256[] storage pointer
// TypeError: (97-105): Unary operator delete cannot be applied to type uint256[] storage pointer

View File

@ -1,6 +1,5 @@
contract Test {
function f() public { var x = new Test(); }
function f() public { Test x = new Test(); }
}
// ----
// Warning: (42-47): Use of the "var" keyword is deprecated.
// TypeError: (50-58): Circular reference for contract creation (cannot create instance of derived or same contract).
// TypeError: (51-59): Circular reference for contract creation (cannot create instance of derived or same contract).

View File

@ -1,5 +0,0 @@
contract C { function f() public { var (x,y); x = 1; y = 1;} }
// ----
// Warning: (40-41): Use of the "var" keyword is deprecated.
// Warning: (42-43): Use of the "var" keyword is deprecated.
// TypeError: (35-44): Assignment necessary for type detection.

View File

@ -3,24 +3,18 @@ contract C {
function two() public returns (uint, uint);
function none();
function f() public {
var (a,) = three();
var (b,c,) = two();
var (,d) = three();
var (,e,g) = two();
(uint a,) = three();
(uint b, uint c,) = two();
(,uint d) = three();
(,uint e, uint g) = two();
var (,,) = three();
var () = none();
a;b;c;d;e;g;
}
}
// ----
// Warning: (177-178): Use of the "var" keyword is deprecated.
// Warning: (205-206): Use of the "var" keyword is deprecated.
// Warning: (207-208): Use of the "var" keyword is deprecated.
// Warning: (234-235): Use of the "var" keyword is deprecated.
// Warning: (262-263): Use of the "var" keyword is deprecated.
// Warning: (264-265): Use of the "var" keyword is deprecated.
// Warning: (172-190): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (200-218): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (228-246): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (256-274): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (172-191): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (201-226): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (236-255): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (265-290): Different number of components on the left hand side (3) than on the right hand side (2).
// Warning: (121-137): No visibility specified. Defaulting to "public".

View File

@ -1,9 +1,7 @@
contract C {
function one() public returns (uint);
function f() public { var (a, b, ) = one(); }
function f() public { (uint a, uint b, ) = one(); }
}
// ----
// Warning: (86-87): Use of the "var" keyword is deprecated.
// Warning: (89-90): Use of the "var" keyword is deprecated.
// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).

View File

@ -1,8 +1,7 @@
contract C {
function one() public returns (uint);
function f() public { var (a, , ) = one(); }
function f() public { (uint a, , ) = one(); }
}
// ----
// Warning: (86-87): Use of the "var" keyword is deprecated.
// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-100): Not enough components (1) in value to assign all variables (2).
// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).

View File

@ -1,8 +1,7 @@
contract C {
function one() public returns (uint);
function f() public { var (, , a) = one(); }
function f() public { (, , uint a) = one(); }
}
// ----
// Warning: (90-91): Use of the "var" keyword is deprecated.
// Warning: (81-100): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-100): Not enough components (1) in value to assign all variables (2).
// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).

View File

@ -1,9 +1,7 @@
contract C {
function one() public returns (uint);
function f() public { var (, a, b) = one(); }
function f() public { (, uint a, uint b) = one(); }
}
// ----
// Warning: (88-89): Use of the "var" keyword is deprecated.
// Warning: (91-92): Use of the "var" keyword is deprecated.
// Warning: (81-101): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-101): Not enough components (1) in value to assign all variables (2).
// Warning: (81-107): Different number of components on the left hand side (3) than on the right hand side (1).
// TypeError: (81-107): Not enough components (1) in value to assign all variables (2).

View File

@ -1,17 +1,13 @@
contract C {
function f() public {
uint a = (1);
var (b,) = (uint8(1),);
var (c,d) = (uint32(1), 2 + a);
var (e,) = (uint64(1), 2, b);
(uint b,) = (uint8(1),);
(uint c, uint d) = (uint32(1), 2 + a);
(uint e,) = (uint64(1), 2, b);
a;b;c;d;e;
}
}
// ----
// Warning: (74-75): Use of the "var" keyword is deprecated.
// Warning: (106-107): Use of the "var" keyword is deprecated.
// Warning: (108-109): Use of the "var" keyword is deprecated.
// Warning: (146-147): Use of the "var" keyword is deprecated.
// Warning: (69-91): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (141-169): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (17-195): Function state mutability can be restricted to pure
// Warning: (69-92): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (149-178): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (17-204): Function state mutability can be restricted to pure

View File

@ -1,10 +1,7 @@
contract C {
function two() public returns (uint, uint);
function f() public { var (a, b, c) = two(); }
function f() public { (uint a, uint b, uint c) = two(); }
}
// ----
// Warning: (92-93): Use of the "var" keyword is deprecated.
// Warning: (95-96): Use of the "var" keyword is deprecated.
// Warning: (98-99): Use of the "var" keyword is deprecated.
// Warning: (87-108): Different number of components on the left hand side (3) than on the right hand side (2).
// TypeError: (87-108): Not enough components (2) in value to assign all variables (3).
// Warning: (87-119): Different number of components on the left hand side (3) than on the right hand side (2).
// TypeError: (87-119): Not enough components (2) in value to assign all variables (3).

View File

@ -1,11 +0,0 @@
contract C {
function f() public { }
function g() public {
var (x,) = (f(), f());
}
}
// ----
// Warning: (80-81): Use of the "var" keyword is deprecated.
// Warning: (87-90): Tuple component cannot be empty.
// Warning: (92-95): Tuple component cannot be empty.
// TypeError: (80-81): Cannot declare variable with void (empty tuple) type.

View File

@ -3,9 +3,11 @@ contract C {
using D for D.s;
D.s x;
function f(uint a) public returns (uint) {
var g = x.mul;
return g({x: a});
function (D.s storage, uint) returns (uint) g = x.mul;
g(x, a);
g(a);
}
}
// ----
// Warning: (218-223): Use of the "var" keyword is deprecated.
// TypeError: (218-271): Type function (struct D.s storage pointer,uint256) returns (uint256) is not implicitly convertible to expected type function (struct D.s storage pointer,uint256) returns (uint256).
// TypeError: (298-302): Wrong argument count for function call: 1 arguments given but expected 2.

View File

@ -5,12 +5,10 @@ library L {
contract C {
function f(uint size) public {
L.S[][] memory x = new L.S[][](10);
var y = new uint[](20);
var z = new bytes(size);
uint[] memory y = new uint[](20);
bytes memory z = new bytes(size);
x;y;z;
}
}
// ----
// Warning: (205-210): Use of the "var" keyword is deprecated.
// Warning: (237-242): Use of the "var" keyword is deprecated.
// Warning: (122-282): Function state mutability can be restricted to pure
// Warning: (122-301): Function state mutability can be restricted to pure

View File

@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
var x = new mapping(uint => uint)[](4);
mapping(uint => uint) x = new mapping(uint => uint)[](4);
}
}
// ----
// Warning: (56-61): Use of the "var" keyword is deprecated.
// TypeError: (68-91): Type cannot live outside storage.
// TypeError: (86-109): Type cannot live outside storage.

View File

@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
var x = new uint(7);
uint x = new uint(7);
}
}
// ----
// Warning: (56-61): Use of the "var" keyword is deprecated.
// TypeError: (64-72): Contract or array type expected.
// TypeError: (65-73): Contract or array type expected.

View File

@ -1,8 +1,7 @@
contract C {
function f(uint size) public {
var x = new uint[]();
uint[] memory x = new uint[]();
}
}
// ----
// Warning: (56-61): Use of the "var" keyword is deprecated.
// TypeError: (64-76): Wrong argument count for function call: 0 arguments given but expected 1.
// TypeError: (74-86): Wrong argument count for function call: 0 arguments given but expected 1.

View File

@ -2,9 +2,8 @@ contract C {
struct S { uint a; uint b; }
function f() public {
var s = S({a: 1});
S memory s = S({a: 1});
}
}
// ----
// Warning: (81-86): Use of the "var" keyword is deprecated.
// TypeError: (89-98): Wrong argument count for struct constructor: 1 arguments given but expected 2.
// TypeError: (94-103): Wrong argument count for struct constructor: 1 arguments given but expected 2.

View File

@ -25,7 +25,7 @@ contract C {
h += 1; // Avoid unused var warning
// string literal
var i = true ? "hello" : "world";
string memory i = true ? "hello" : "world";
i = "used"; //Avoid unused var warning
}
function f2() public {
@ -38,18 +38,18 @@ contract C {
// array
byte[2] memory a;
byte[2] memory b;
var k = true ? a : b;
byte[2] memory k = true ? a : b;
k[0] = byte(0); //Avoid unused var warning
bytes memory e;
bytes memory f;
var l = true ? e : f;
bytes memory l = true ? e : f;
l[0] = byte(0); // Avoid unused var warning
// fixed bytes
bytes2 c;
bytes2 d;
var m = true ? c : d;
bytes2 m = true ? c : d;
m &= m;
}
@ -60,7 +60,7 @@ contract C {
struct_x = true ? struct_x : struct_y;
// function
var r = true ? fun_x : fun_y;
function () r = true ? fun_x : fun_y;
r(); // Avoid unused var warning
// enum
small enum_x;
@ -68,13 +68,13 @@ contract C {
enum_x = true ? enum_x : enum_y;
// tuple
var (n, o) = true ? (1, 2) : (3, 4);
(uint n, uint o) = true ? (1, 2) : (3, 4);
(n, o) = (o, n); // Avoid unused var warning
// mapping
var p = true ? table1 : table2;
mapping(uint8 => uint8) p = true ? table1 : table2;
p[0] = 0; // Avoid unused var warning
// typetype
var q = true ? uint32(1) : uint32(2);
uint32 q = true ? uint32(1) : uint32(2);
q += 1; // Avoid unused var warning
// modifier doesn't fit in here
@ -84,17 +84,8 @@ contract C {
}
}
// ----
// Warning: (546-551): Use of the "var" keyword is deprecated.
// Warning: (878-883): Use of the "var" keyword is deprecated.
// Warning: (1008-1013): Use of the "var" keyword is deprecated.
// Warning: (1150-1155): Use of the "var" keyword is deprecated.
// Warning: (1357-1362): Use of the "var" keyword is deprecated.
// Warning: (1560-1561): Use of the "var" keyword is deprecated.
// Warning: (1563-1564): Use of the "var" keyword is deprecated.
// Warning: (1672-1677): Use of the "var" keyword is deprecated.
// Warning: (1778-1783): Use of the "var" keyword is deprecated.
// Warning: (984-998): This declaration shadows an existing declaration.
// Warning: (1005-1019): This declaration shadows an existing declaration.
// Warning: (90-116): Function state mutability can be restricted to pure
// Warning: (121-147): Function state mutability can be restricted to pure
// Warning: (257-632): Function state mutability can be restricted to pure
// Warning: (637-1194): Function state mutability can be restricted to pure
// Warning: (257-642): Function state mutability can be restricted to pure
// Warning: (647-1227): Function state mutability can be restricted to pure

View File

@ -1,9 +1,7 @@
contract test {
function f() public {
var a = 3 ** ufixed(1.5);
ufixed a = 3 ** ufixed(1.5);
}
}
// ----
// Warning: (50-55): Use of the "var" keyword is deprecated.
// TypeError: (58-74): Operator ** not compatible with types int_const 3 and ufixed128x18
// Warning: (50-74): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// TypeError: (61-77): Operator ** not compatible with types int_const 3 and ufixed128x18

View File

@ -1,9 +1,7 @@
contract test {
function f() public {
var c = 42 ** fixed(-1/4);
ufixed c = 42 ** fixed(-1/4);
}
}
// ----
// Warning: (50-55): Use of the "var" keyword is deprecated.
// TypeError: (58-75): Operator ** not compatible with types int_const 42 and fixed128x18
// Warning: (50-75): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// TypeError: (61-78): Operator ** not compatible with types int_const 42 and fixed128x18

View File

@ -1,16 +0,0 @@
contract test {
function f() public {
var a = 0.12345678;
var b = 12345678.352;
var c = 0.00000009;
a; b; c;
}
}
// ----
// Warning: (50-55): Use of the "var" keyword is deprecated.
// Warning: (78-83): Use of the "var" keyword is deprecated.
// Warning: (108-113): Use of the "var" keyword is deprecated.
// Warning: (50-68): The type of this variable was inferred as ufixed24x8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (78-98): The type of this variable was inferred as ufixed40x3. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (108-126): The type of this variable was inferred as ufixed8x8. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (20-150): Function state mutability can be restricted to pure

View File

@ -1,12 +0,0 @@
contract test {
function f() public {
var (a, b) = (.5, 1/3);
a; b;
}
}
// ----
// Warning: (55-56): Use of the "var" keyword is deprecated.
// Warning: (58-59): Use of the "var" keyword is deprecated.
// Warning: (50-72): The type of this variable was inferred as ufixed8x1. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (50-72): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (20-93): Function state mutability can be restricted to pure

View File

@ -1,10 +0,0 @@
contract test {
function f() public {
var x = 1/3;
}
}
// ----
// Warning: (50-55): Use of the "var" keyword is deprecated.
// Warning: (50-61): The type of this variable was inferred as ufixed256x77. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (50-55): Unused local variable.
// Warning: (20-68): Function state mutability can be restricted to pure

View File

@ -1,9 +1,6 @@
contract C {
function f() public {
var x = 0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E;
x.send(2);
(0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E).transfer(2);
}
}
// ----
// Warning: (47-52): Use of the "var" keyword is deprecated.
// Warning: (107-116): Failure condition of 'send' ignored. Consider using 'transfer' instead.

View File

@ -1,10 +1,8 @@
contract C {
function h() pure external {
}
function f() view external returns (bytes4) {
var g = this.h;
return g.selector;
function f() pure external returns (bytes4) {
return this.h.selector;
}
}
// ----
// Warning: (110-115): Use of the "var" keyword is deprecated.

View File

@ -3,9 +3,7 @@ contract C {
}
function f() view external returns (bytes4) {
function () pure external g = this.h;
var i = g;
return i.selector;
return g.selector;
}
}
// ----
// Warning: (156-161): Use of the "var" keyword is deprecated.

View File

@ -9,14 +9,13 @@ contract C {
}
contract D {
function f() {
var x = (new C()).balance();
uint x = (new C()).balance();
x;
(new C()).transfer(5);
}
}
// ----
// Warning: (282-287): Use of the "var" keyword is deprecated.
// Warning: (17-127): No visibility specified. Defaulting to "public".
// Warning: (132-239): No visibility specified. Defaulting to "public".
// Warning: (259-358): No visibility specified. Defaulting to "public".
// Warning: (259-359): No visibility specified. Defaulting to "public".
// Warning: (17-127): Function state mutability can be restricted to view

View File

@ -1,11 +1,9 @@
contract test {
function fun(uint256 a) returns (uint) {
if (a >= 8) { return 2; } else { var b = 7; }
if (a >= 8) { return 2; } else { uint b = 7; }
}
}
// ----
// Warning: (102-107): Use of the "var" keyword is deprecated.
// Warning: (102-111): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (20-120): No visibility specified. Defaulting to "public".
// Warning: (102-107): Unused local variable.
// Warning: (20-120): Function state mutability can be restricted to pure
// Warning: (20-121): No visibility specified. Defaulting to "public".
// Warning: (102-108): Unused local variable.
// Warning: (20-121): Function state mutability can be restricted to pure

View File

@ -1,29 +1,15 @@
contract C {
function f() {
var (a,b,c) = g();
var (d) = 2;
var (,e) = 3;
var (f,) = 4;
var (x,,) = g();
var (,y,) = g();
var () = g();
var (,,) = g();
function f() pure public {
(uint a, uint b, uint c) = g();
(uint d) = 2;
(, uint e) = 3;
(uint h,) = 4;
(uint x,,) = g();
(, uint y,) = g();
a; b; c; d; e; h; x; y;
}
function g() returns (uint, uint, uint) {}
function g() pure public returns (uint, uint, uint) {}
}
// ----
// Warning: (36-37): Use of the "var" keyword is deprecated.
// Warning: (38-39): Use of the "var" keyword is deprecated.
// Warning: (40-41): Use of the "var" keyword is deprecated.
// Warning: (57-58): Use of the "var" keyword is deprecated.
// Warning: (73-74): Use of the "var" keyword is deprecated.
// Warning: (88-89): Use of the "var" keyword is deprecated.
// Warning: (104-105): Use of the "var" keyword is deprecated.
// Warning: (124-125): Use of the "var" keyword is deprecated.
// Warning: (88-89): This declaration shadows an existing declaration.
// Warning: (52-63): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (67-79): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (67-79): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (83-95): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (83-95): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// TypeError: (137-149): Too many components (3) in value for variable assignment (0) needed
// Warning: (93-107): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (111-124): Different number of components on the left hand side (2) than on the right hand side (1).

View File

@ -1,11 +1,9 @@
contract c {
function fun() returns (uint r) {
var _ = 8;
uint _ = 8;
return _ + 1;
}
}
// ----
// Warning: (59-64): Use of the "var" keyword is deprecated.
// Warning: (59-68): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (17-97): No visibility specified. Defaulting to "public".
// Warning: (17-97): Function state mutability can be restricted to pure
// Warning: (17-98): No visibility specified. Defaulting to "public".
// Warning: (17-98): Function state mutability can be restricted to pure

View File

@ -1,24 +1,17 @@
contract C {
function f() {
uint a = (1);
var (b,) = (1,);
var (c,d) = (1, 2 + a);
var (e,) = (1, 2, b);
(uint b,) = (1,);
(uint c, uint d) = (1, 2 + a);
(uint e,) = (1, 2, b);
(a) = 3;
}
}
// ----
// Warning: (52-53): Use of the "var" keyword is deprecated.
// Warning: (71-72): Use of the "var" keyword is deprecated.
// Warning: (73-74): Use of the "var" keyword is deprecated.
// Warning: (97-98): Use of the "var" keyword is deprecated.
// Warning: (47-62): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (47-62): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (66-88): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (92-112): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (92-112): The type of this variable was inferred as uint8, which can hold values between 0 and 255. This is probably not desired. Use an explicit type to silence this warning.
// Warning: (14-127): No visibility specified. Defaulting to "public".
// Warning: (71-72): Unused local variable.
// Warning: (73-74): Unused local variable.
// Warning: (97-98): Unused local variable.
// Warning: (14-127): Function state mutability can be restricted to pure
// Warning: (47-63): Different number of components on the left hand side (2) than on the right hand side (1).
// Warning: (100-121): Different number of components on the left hand side (2) than on the right hand side (3).
// Warning: (14-136): No visibility specified. Defaulting to "public".
// Warning: (68-74): Unused local variable.
// Warning: (76-82): Unused local variable.
// Warning: (101-107): Unused local variable.
// Warning: (14-136): Function state mutability can be restricted to pure

View File

@ -1,11 +1,8 @@
contract C {
function f() public pure returns (uint, uint, uint, uint) {
// Can later be replaced by (uint a, uint b,) = f();
var (a,b,) = f();
(uint a, uint b,) = f();
a; b;
}
}
// ----
// Warning: (136-137): Use of the "var" keyword is deprecated.
// Warning: (138-139): Use of the "var" keyword is deprecated.
// Warning: (131-147): Different number of components on the left hand side (3) than on the right hand side (4).
// Warning: (76-99): Different number of components on the left hand side (3) than on the right hand side (4).