mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	moved and created new semantic tests.
This commit is contained in:
		
							parent
							
								
									283f85b091
								
							
						
					
					
						commit
						f299f0cb33
					
				| @ -0,0 +1,15 @@ | ||||
| contract C { | ||||
|     struct Mail { | ||||
|         address from; | ||||
|         address to; | ||||
|         string contents; | ||||
|     } | ||||
| 
 | ||||
|     function f() public pure returns(bool) { | ||||
|         return type(Mail).typehash == keccak256("Mail(address from,address to,string contents)"); | ||||
|     } | ||||
| } | ||||
| // ==== | ||||
| // compileToEwasm: also | ||||
| // ---- | ||||
| // f() -> true | ||||
| @ -15,11 +15,11 @@ library B { | ||||
| } | ||||
| 
 | ||||
| contract C { | ||||
|     function f() public pure { | ||||
|         assert(A.a == B.b); | ||||
|     function f() public pure returns(bool) { | ||||
|         return A.a == B.b; | ||||
|     } | ||||
| } | ||||
| // ==== | ||||
| // SMTEngine: all | ||||
| // compileToEwasm: also | ||||
| // ---- | ||||
| // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. | ||||
| // f() -> true | ||||
| @ -0,0 +1,23 @@ | ||||
| struct S { | ||||
|     uint256 x; | ||||
| } | ||||
| 
 | ||||
| bytes32 constant TYPE_HASH_FILE_LEVEL = type(S).typehash; | ||||
| 
 | ||||
| contract C { | ||||
|     struct S { | ||||
|         uint256 y; | ||||
|     } | ||||
| 
 | ||||
|     function f() public pure returns(bool, bool, bool) { | ||||
|         return ( | ||||
|             type(S).typehash == keccak256("S(uint256 y)"), | ||||
|             type(S).typehash == TYPE_HASH_FILE_LEVEL, | ||||
|             TYPE_HASH_FILE_LEVEL == keccak256("S(uint256 x)") | ||||
|         ); | ||||
|     } | ||||
| } | ||||
| // ==== | ||||
| // compileToEwasm: also | ||||
| // ---- | ||||
| // f() -> true, false, true | ||||
| @ -0,0 +1,16 @@ | ||||
| contract A { | ||||
|     struct S { | ||||
|         string x; | ||||
|         bool[10][] y; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| contract C is A { | ||||
|     function f() public pure returns(bool) { | ||||
|         return type(S).typehash == keccak256("S(string x,bool[10][] y)"); | ||||
|     } | ||||
| } | ||||
| // ==== | ||||
| // compileToEwasm: also | ||||
| // ---- | ||||
| // f() -> true | ||||
| @ -1,19 +0,0 @@ | ||||
| contract A { | ||||
|     struct S { | ||||
|         string x; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| contract B { | ||||
|     struct S { | ||||
|         bool y; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| contract C is A, B { | ||||
|     function f() public pure { | ||||
|         assert(type(A.S).typehash != type(B.S).typehash); | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
| // DeclarationError 9097: (72-104): Identifier already declared. | ||||
| @ -1,27 +0,0 @@ | ||||
| struct S { | ||||
|     uint256 x; | ||||
| } | ||||
| 
 | ||||
| bytes32 constant TYPE_HASH_FILE_LEVEL = type(S).typehash; | ||||
| 
 | ||||
| contract A { | ||||
|     function f() public pure { | ||||
|         // TYPE_HASH_FILE_LEVEL == keccak256("S(uint256 x)") | ||||
|         assert(TYPE_HASH_FILE_LEVEL == 0x2a7af8c10b1d48ad8e0a6aad976d8385e84377b5bd03b59e2c445dc430ac2ca2); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| contract C { | ||||
|     struct S { | ||||
|         uint256 y; | ||||
|     } | ||||
| 
 | ||||
|     function f() public pure { | ||||
|         // type(S).typehash == keccak256("S(uint256 y)") and not the shadowed file-level struct S | ||||
|         assert(type(S).typehash == 0xea24952476a382c98f2d2e42112ff8a673d8ed19d22ffc89ee9fe2f415bf6c35); | ||||
|         assert(type(S).typehash != TYPE_HASH_FILE_LEVEL); | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
| // Warning 2519: (327-362): This declaration shadows an existing declaration. | ||||
| // Info 1391: CHC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. | ||||
| @ -1,15 +0,0 @@ | ||||
| contract A { | ||||
|     struct S { | ||||
|         string x; | ||||
|         bool[10][] y; | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| contract C is A { | ||||
|     function f() public pure { | ||||
|         // keccak256("S(string x,bool[10][] y)") | ||||
|         assert(type(S).typehash == 0xb4abec9b1d4b9d4724891b27b275d7d5e1692fe69fe6ff78379f613500046c11); | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
| // Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them. | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user