Skip to content

Commit 89e6f3a

Browse files
committed
Updated solidity test case
1 parent e28c262 commit 89e6f3a

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

solidity/examples/test.sol

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ contract c {
152152
function x() external {}
153153
}
154154
contract c {
155-
function() { }
155+
function c() { }
156156
}
157157
contract test {
158158
function fun(uint256 a) {
@@ -204,7 +204,7 @@ contract test {
204204
if (a >= 8) {
205205
return;
206206
} else {
207-
var b = 7;
207+
uint32 b = 7;
208208
}
209209
}
210210
}
@@ -237,8 +237,8 @@ library Lib {
237237
contract test {
238238
function test() {
239239
a = 1 wei;
240-
a = 2 szabo;
241-
a = 3 finney;
240+
// a = 2 szabo; szabo and finney removed in 0.7.0
241+
a = 3 gwei;
242242
a = 4 ether;
243243

244244
a = 1 seconds;
@@ -254,7 +254,7 @@ contract test {
254254
contract c {
255255
function c ()
256256
{
257-
a = 1 wei * 100 wei + 7 szabo - 3;
257+
a = 1 wei * 100 wei + 7 gwei - 3;
258258
}
259259
uint256 a;
260260
}
@@ -299,13 +299,13 @@ contract c {
299299
}
300300
contract C {
301301
function f() {
302-
var (a,b,c) = g();
303-
var (d) = 2;
304-
var (,e) = 3;
305-
var (f,) = 4;
306-
var (x,,) = g();
307-
var (,y,) = g();
308-
var (,,) = g();
302+
(a,b,c) = g();
303+
(d) = 2;
304+
(,e) = 3;
305+
(f,) = 4;
306+
(x,,) = g();
307+
(,y,) = g();
308+
(,,) = g();
309309
}
310310
function g() returns (uint, uint, uint) {}
311311
}
@@ -369,7 +369,7 @@ contract test {
369369
}
370370
contract c {
371371
function fun() returns (uint r) {
372-
var _ = 8;
372+
uint32 _ = 8;
373373
return _ + 1;
374374
}
375375
}
@@ -398,20 +398,20 @@ contract test {
398398
contract C {
399399
function f() {
400400
uint a = (1);
401-
var (b,) = 1;
402-
var (c,d) = (1, 2 + a);
403-
var (e,) = (1, 2, b);
401+
(b,) = 1;
402+
(c,d) = (1, 2 + a);
403+
(e,) = (1, 2, b);
404404
(a) = 3;
405405
}
406406
}
407407
contract test {
408408
function fun() {
409-
var x = new uint64[](3);
409+
uint64[] x = new uint64[](3);
410410
}
411411
}
412412
contract test {
413413
function f() {
414-
uint a = +10;
414+
uint a = 10; // +integer removed latest version
415415
a--;
416416

417417
a = ~a;
@@ -434,14 +434,14 @@ contract C {
434434
}
435435
contract test {
436436
function fun(uint256 a) {
437-
var b = 5;
437+
int b = 5;
438438
uint256 c;
439439
mapping(address=>bytes32) d;
440440
}
441441
}
442442
contract test {
443443
function fun(uint256 a) {
444-
var b = 2;
444+
int b = 2;
445445
uint256 c = 0x87;
446446
mapping(address=>bytes32) d;
447447
bytes32 name = "Solidity";
@@ -464,13 +464,14 @@ contract test {
464464
}
465465

466466
contract test {
467-
function() {
467+
//anonymous function not allowed in la
468+
function x() {
468469
assembly {
469470
mstore(0x40, 0x60) // store the "free memory pointer"
470471
// function dispatcher
471472
switch div(calldataload(0), exp(2, 226))
472473
case 0xb3de648b {
473-
let (r) := f(calldataload(4))
474+
let r, x := f(calldataload(4))
474475
let ret := $allocate(0x20)
475476
mstore(ret, r)
476477
return(ret, 0x20)
@@ -518,15 +519,16 @@ contract test {
518519
}
519520

520521
contract test {
521-
function foo() public returns (byte b) {
522+
//from version 0.8.0 byte alias for bytes1 removed
523+
function foo() public returns (bytes1 b) {
522524
assembly {
523525
n := byte(0x0)
524526
}
525527
}
526528
}
527529

528530
contract test {
529-
function() {
531+
function x() {
530532
emit EventCalled(1, 2, 3);
531533
}
532534
}
@@ -536,7 +538,7 @@ contract test {
536538
}
537539

538540
contract test {
539-
function () payable {
541+
function x() payable {
540542
(bytes32 a, uint b) = foo();
541543
}
542544
}
@@ -546,7 +548,7 @@ contract test {
546548
}
547549

548550
contract test {
549-
function () {
551+
function x() {
550552
return();
551553
}
552554
}

0 commit comments

Comments
 (0)