mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #13754 from ethereum/smt_fix_assignment
Fix internal error in assignment chains
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
contract C {
|
||||
string public name = (C).name = type(C).name;
|
||||
|
||||
function f() external view {
|
||||
assert(keccak256(bytes(name)) == keccak256(bytes("C"))); // should fail because SMTChecker doesn't support type(C).name
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 7507: (49-61): Assertion checker does not yet support this expression.
|
||||
// Warning 6328: (105-160): CHC: Assertion violation happens here.\nCounterexample:\n\n\nTransaction trace:\nC.constructor()\nC.f()
|
||||
@@ -0,0 +1,13 @@
|
||||
contract C {
|
||||
uint x = ((((C)))).x = ((C)).x = 2;
|
||||
|
||||
function f() external view {
|
||||
assert(x == 2); // should hold
|
||||
}
|
||||
|
||||
function g() external view {
|
||||
assert(x != 2); // should fail
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (174-188): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\nTransaction trace:\nC.constructor()\nState: x = 2\nC.g()
|
||||
@@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
uint x = ((((C)))).x = ((C)).x = 2;
|
||||
|
||||
function f() external view {
|
||||
assert(x == 2); // should fail for D
|
||||
}
|
||||
|
||||
function g() external view {
|
||||
assert(x != 2); // should fail for C
|
||||
}
|
||||
}
|
||||
|
||||
contract D is C {
|
||||
uint y = ((C)).x = 3;
|
||||
|
||||
function h() external view {
|
||||
assert(y == 3); // should hold
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// Warning 6328: (95-109): CHC: Assertion violation happens here.\nCounterexample:\ny = 3, x = 3\n\nTransaction trace:\nD.constructor()\nState: y = 3, x = 3\nC.f()
|
||||
// Warning 6328: (180-194): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\nTransaction trace:\nC.constructor()\nState: x = 2\nC.g()
|
||||
Reference in New Issue
Block a user