mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #7705 from ethereum/list-overloads-7146
List candidates when overload failed
This commit is contained in:
		
						commit
						c4441bac5b
					
				| @ -9,6 +9,7 @@ Compiler Features: | ||||
|  * SMTChecker: Add break/continue support to the CHC engine. | ||||
|  * SMTChecker: Support assignments to multi-dimensional arrays and mappings. | ||||
|  * SMTChecker: Support inheritance and function overriding. | ||||
|  * TypeChecker: List possible candidates when overload resolution fails | ||||
|  * EWasm: Experimental EWasm binary output. | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -2352,12 +2352,19 @@ bool TypeChecker::visit(Identifier const& _identifier) | ||||
| 				if (functionType->canTakeArguments(*annotation.arguments)) | ||||
| 					candidates.push_back(declaration); | ||||
| 			} | ||||
| 			if (candidates.empty()) | ||||
| 				m_errorReporter.fatalTypeError(_identifier.location(), "No matching declaration found after argument-dependent lookup."); | ||||
| 			else if (candidates.size() == 1) | ||||
| 			if (candidates.size() == 1) | ||||
| 				annotation.referencedDeclaration = candidates.front(); | ||||
| 			else | ||||
| 				m_errorReporter.fatalTypeError(_identifier.location(), "No unique declaration found after argument-dependent lookup."); | ||||
| 			{ | ||||
| 				SecondarySourceLocation ssl; | ||||
| 
 | ||||
| 				for (Declaration const* declaration: annotation.overloadedDeclarations) | ||||
| 					ssl.append("Candidate:", declaration->location()); | ||||
| 				if (candidates.empty()) | ||||
| 					m_errorReporter.fatalTypeError(_identifier.location(), ssl, "No matching declaration found after argument-dependent lookup."); | ||||
| 				else | ||||
| 					m_errorReporter.fatalTypeError(_identifier.location(), ssl, "No unique declaration found after argument-dependent lookup."); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	solAssert( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user