mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #3799 from meowingtwurtle/fixLiteralComparisons
Fix bug in typechecking when comparing rational literals
This commit is contained in:
		
						commit
						b7b6d0ce7c
					
				| @ -27,6 +27,7 @@ Bugfixes: | ||||
|  * DocString Parser: Fix error message for empty descriptions. | ||||
|  * Standard JSON: Support ``constantinople`` as ``evmVersion`` properly. | ||||
|  * Type Checker: Fix detection of recursive structs. | ||||
|  * Type Checker: Fix asymmetry bug when comparing with literal numbers. | ||||
|  * Type System: Improve error message when attempting to shift by a fractional amount. | ||||
|  * Type System: Make external library functions accessible. | ||||
|  * Type System: Prevent encoding of weird types. | ||||
|  | ||||
| @ -839,10 +839,10 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ | ||||
| { | ||||
| 	if (_other->category() == Category::Integer || _other->category() == Category::FixedPoint) | ||||
| 	{ | ||||
| 		auto mobile = mobileType(); | ||||
| 		if (!mobile) | ||||
| 		auto commonType = Type::commonType(shared_from_this(), _other); | ||||
| 		if (!commonType) | ||||
| 			return TypePointer(); | ||||
| 		return mobile->binaryOperatorResult(_operator, _other); | ||||
| 		return commonType->binaryOperatorResult(_operator, _other); | ||||
| 	} | ||||
| 	else if (_other->category() != category()) | ||||
| 		return TypePointer(); | ||||
|  | ||||
							
								
								
									
										7
									
								
								test/libsolidity/syntaxTests/literal_comparisons.sol
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								test/libsolidity/syntaxTests/literal_comparisons.sol
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | ||||
| contract test { | ||||
|     function f(int8 x) public pure { | ||||
|         if (x == 1) {} | ||||
|         if (1 == x) {} | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user