mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Move collision warnings to StaticAnalyzer
This commit is contained in:
		
							parent
							
								
									e7a6534d4f
								
							
						
					
					
						commit
						d8520b0af0
					
				| @ -156,6 +156,20 @@ bool StaticAnalyzer::visit(VariableDeclaration const& _variable) | ||||
| 			// This is not a no-op, the entry might pre-exist.
 | ||||
| 			m_localVarUseCount[make_pair(_variable.id(), &_variable)] += 0; | ||||
| 	} | ||||
| 
 | ||||
| 	if (_variable.isStateVariable() || _variable.referenceLocation() == VariableDeclaration::Location::Storage) | ||||
| 	{ | ||||
| 		TypePointer varType = _variable.annotation().type; | ||||
| 		for (Type const* subtype: frontend::oversizedSubtypes(*varType)) | ||||
| 		{ | ||||
| 			string message = "Type " + subtype->toString(true) + | ||||
| 				" covers a large part of storage and thus makes collisions likely." | ||||
| 				" Either use mappings or dynamic arrays and allow their size to be increased only" | ||||
| 				" in small quantities per transaction."; | ||||
| 			m_errorReporter.warning(7325_error, _variable.typeName().location(), message); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return true; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -609,19 +609,6 @@ bool TypeChecker::visit(VariableDeclaration const& _variable) | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	if (varType->dataStoredIn(DataLocation::Storage)) | ||||
| 	{ | ||||
| 		vector<Type const*> oversizedSubtypes = frontend::oversizedSubtypes(*varType); | ||||
| 		for (Type const* subtype: oversizedSubtypes) | ||||
| 		{ | ||||
| 			string message = "Type " + subtype->toString(true) + | ||||
| 				" covers a large part of storage and thus makes collisions likely." | ||||
| 				" Either use mappings or dynamic arrays and allow their size to be increased only" | ||||
| 				" in small quantities per transaction."; | ||||
| 			m_errorReporter.warning(7325_error, _variable.typeName().location(), message); | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	return false; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -6,5 +6,3 @@ contract C { | ||||
| } | ||||
| // ---- | ||||
| // TypeError 7676: (60-114): Contract too large for storage. | ||||
| // Warning 7325: (77-89): Type uint256[57896044618658097711785492504343953926634992332820282019728792003956564819968] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. | ||||
| // Warning 7325: (97-109): Type uint256[57896044618658097711785492504343953926634992332820282019728792003956564819968] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. | ||||
|  | ||||
| @ -8,5 +8,3 @@ contract D is C { | ||||
| } | ||||
| // ---- | ||||
| // TypeError 7676: (95-134): Contract too large for storage. | ||||
| // Warning 7325: (77-89): Type uint256[57896044618658097711785492504343953926634992332820282019728792003956564819968] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. | ||||
| // Warning 7325: (117-129): Type uint256[57896044618658097711785492504343953926634992332820282019728792003956564819968] covers a large part of storage and thus makes collisions likely. Either use mappings or dynamic arrays and allow their size to be increased only in small quantities per transaction. | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user