mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Extract constant cycle tests.
This commit is contained in:
committed by
Alex Beregszaszi
parent
eb5b18e814
commit
8fdbd19a05
@@ -0,0 +1,5 @@
|
||||
contract C {
|
||||
uint constant a = a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: The value of the constant a has a cyclic dependency via a.
|
||||
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
uint constant a = b * c;
|
||||
uint constant b = 7;
|
||||
uint constant c = b + uint(keccak256(d));
|
||||
uint constant d = 2 + a;
|
||||
}
|
||||
// ----
|
||||
// TypeError: The value of the constant a has a cyclic dependency via c.
|
||||
// TypeError: The value of the constant c has a cyclic dependency via d.
|
||||
// TypeError: The value of the constant d has a cyclic dependency via a.
|
||||
@@ -0,0 +1,11 @@
|
||||
contract C {
|
||||
uint constant x = a;
|
||||
uint constant a = b * c;
|
||||
uint constant b = c;
|
||||
uint constant c = b;
|
||||
}
|
||||
// ----
|
||||
// TypeError: The value of the constant x has a cyclic dependency via a.
|
||||
// TypeError: The value of the constant a has a cyclic dependency via b.
|
||||
// TypeError: The value of the constant b has a cyclic dependency via c.
|
||||
// TypeError: The value of the constant c has a cyclic dependency via b.
|
||||
@@ -0,0 +1,6 @@
|
||||
contract C {
|
||||
uint constant a = b * c;
|
||||
uint constant b = 7;
|
||||
uint constant c = 4 + uint(keccak256(d));
|
||||
uint constant d = 2 + b;
|
||||
}
|
||||
Reference in New Issue
Block a user