mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #9044 from ethereum/issue-9028
Fix failure to find overload resolution when overrides are involved
This commit is contained in:
		
						commit
						ee8307ceed
					
				| @ -19,6 +19,7 @@ Bugfixes: | ||||
|  * Type Checker: Disallow inline arrays of non-nameable types. | ||||
|  * Type Checker: Fix internal compiler error when accessing members of array slices. | ||||
|  * Type Checker: Fix internal compiler error when trying to decode too large static arrays. | ||||
|  * Type Checker: Fix wrong compiler error when referencing an overridden function without calling it. | ||||
|  * NatSpec: DocString block is terminated when encountering an empty line. | ||||
|  * Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL. | ||||
|  * Code Generator: Trigger proper unimplemented errors on certain array copy operations. | ||||
|  | ||||
| @ -2981,7 +2981,11 @@ bool TypeChecker::visit(Identifier const& _identifier) | ||||
| 	if (!annotation.referencedDeclaration) | ||||
| 	{ | ||||
| 		annotation.overloadedDeclarations = cleanOverloadedDeclarations(_identifier, annotation.candidateDeclarations); | ||||
| 		if (!annotation.arguments) | ||||
| 		if (annotation.overloadedDeclarations.empty()) | ||||
| 			m_errorReporter.fatalTypeError(7593_error, _identifier.location(), "No candidates for overload resolution found."); | ||||
| 		else if (annotation.overloadedDeclarations.size() == 1) | ||||
| 			annotation.referencedDeclaration = *annotation.overloadedDeclarations.begin(); | ||||
| 		else if (!annotation.arguments) | ||||
| 		{ | ||||
| 			// The identifier should be a public state variable shadowing other functions
 | ||||
| 			vector<Declaration const*> candidates; | ||||
| @ -2998,10 +3002,6 @@ bool TypeChecker::visit(Identifier const& _identifier) | ||||
| 			else | ||||
| 				m_errorReporter.fatalTypeError(7589_error, _identifier.location(), "No unique declaration found after variable lookup."); | ||||
| 		} | ||||
| 		else if (annotation.overloadedDeclarations.empty()) | ||||
| 			m_errorReporter.fatalTypeError(7593_error, _identifier.location(), "No candidates for overload resolution found."); | ||||
| 		else if (annotation.overloadedDeclarations.size() == 1) | ||||
| 			annotation.referencedDeclaration = *annotation.overloadedDeclarations.begin(); | ||||
| 		else | ||||
| 		{ | ||||
| 			vector<Declaration const*> candidates; | ||||
|  | ||||
| @ -0,0 +1,11 @@ | ||||
| contract A { | ||||
|     function f() virtual internal {} | ||||
| } | ||||
| contract B is A { | ||||
|     function f() virtual override internal {} | ||||
|     function h() pure internal { f; } | ||||
| } | ||||
| contract C is B { | ||||
|     function f() override internal {} | ||||
|     function i() pure internal { f; } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user