mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Add syntax tests and Changelog entry
This commit is contained in:
		
							parent
							
								
									ab251c7e7d
								
							
						
					
					
						commit
						d43436cfec
					
				| @ -1,3 +1,8 @@ | |||||||
|  | ### 0.5.0 (unreleased) | ||||||
|  | Features: | ||||||
|  |  * Type Checker: Disallow arithmetic operations for Boolean variables. | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| ### 0.4.24 (unreleased) | ### 0.4.24 (unreleased) | ||||||
| 
 | 
 | ||||||
| Features: | Features: | ||||||
|  | |||||||
							
								
								
									
										53
									
								
								test/libsolidity/syntaxTests/types/bool_ops.sol
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								test/libsolidity/syntaxTests/types/bool_ops.sol
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,53 @@ | |||||||
|  | contract C { | ||||||
|  |     function f(bool a, bool b) public pure { | ||||||
|  |         bool c; | ||||||
|  |         // OK | ||||||
|  |         c = !a; | ||||||
|  |         c = !b; | ||||||
|  |         c = a == b; | ||||||
|  |         c = a != b; | ||||||
|  |         c = a || b; | ||||||
|  |         c = a && b; | ||||||
|  | 
 | ||||||
|  |         // Not OK | ||||||
|  |         c = a > b; | ||||||
|  |         c = a < b; | ||||||
|  |         c = a >= b; | ||||||
|  |         c = a <= b; | ||||||
|  |         c = a & b; | ||||||
|  |         c = a | b; | ||||||
|  |         c = a ^ b; | ||||||
|  |         c = ~a; | ||||||
|  |         c = ~b; | ||||||
|  |         c = a + b; | ||||||
|  |         c = a - b; | ||||||
|  |         c = -a; | ||||||
|  |         c = -b; | ||||||
|  |         c = a * b; | ||||||
|  |         c = a / b; | ||||||
|  |         c = a ** b; | ||||||
|  |         c = a % b; | ||||||
|  |         c = a << b; | ||||||
|  |         c = a >> b; | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | // ---- | ||||||
|  | // TypeError: (231-236): Operator > not compatible with types bool and bool | ||||||
|  | // TypeError: (250-255): Operator < not compatible with types bool and bool | ||||||
|  | // TypeError: (269-275): Operator >= not compatible with types bool and bool | ||||||
|  | // TypeError: (289-295): Operator <= not compatible with types bool and bool | ||||||
|  | // TypeError: (309-314): Operator & not compatible with types bool and bool | ||||||
|  | // TypeError: (328-333): Operator | not compatible with types bool and bool | ||||||
|  | // TypeError: (347-352): Operator ^ not compatible with types bool and bool | ||||||
|  | // TypeError: (366-368): Unary operator ~ cannot be applied to type bool | ||||||
|  | // TypeError: (382-384): Unary operator ~ cannot be applied to type bool | ||||||
|  | // TypeError: (398-403): Operator + not compatible with types bool and bool | ||||||
|  | // TypeError: (417-422): Operator - not compatible with types bool and bool | ||||||
|  | // TypeError: (436-438): Unary operator - cannot be applied to type bool | ||||||
|  | // TypeError: (452-454): Unary operator - cannot be applied to type bool | ||||||
|  | // TypeError: (468-473): Operator * not compatible with types bool and bool | ||||||
|  | // TypeError: (487-492): Operator / not compatible with types bool and bool | ||||||
|  | // TypeError: (506-512): Operator ** not compatible with types bool and bool | ||||||
|  | // TypeError: (526-531): Operator % not compatible with types bool and bool | ||||||
|  | // TypeError: (545-551): Operator << not compatible with types bool and bool | ||||||
|  | // TypeError: (565-571): Operator >> not compatible with types bool and bool | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user