mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #9027 from ethereum/issue-8265
Fix ICE by avoiding copyForLocation() on ArraySliceType
This commit is contained in:
		
						commit
						d989dfd43f
					
				| @ -13,6 +13,7 @@ Compiler Features: | ||||
| Bugfixes: | ||||
|  * Optimizer: Fixed a bug in BlockDeDuplicator. | ||||
|  * Type Checker: Disallow assignments to storage variables of type ``mapping``. | ||||
|  * Type Checker: Fix internal compiler error when accessing members of array slices. | ||||
|  * 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. | ||||
|  | ||||
| @ -2555,7 +2555,7 @@ bool TypeChecker::visit(MemberAccess const& _memberAccess) | ||||
| 
 | ||||
| 	if (possibleMembers.empty()) | ||||
| 	{ | ||||
| 		if (initialMemberCount == 0) | ||||
| 		if (initialMemberCount == 0 && !dynamic_cast<ArraySliceType const*>(exprType)) | ||||
| 		{ | ||||
| 			// Try to see if the member was removed because it is only available for storage types.
 | ||||
| 			auto storageType = TypeProvider::withLocationIfReference( | ||||
|  | ||||
| @ -349,14 +349,17 @@ TypePointer Type::fullEncodingType(bool _inLibraryCall, bool _encoderV2, bool) c | ||||
| MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition const& _scope) | ||||
| { | ||||
| 	// Normalise data location of type.
 | ||||
| 	TypePointer type = TypeProvider::withLocationIfReference(DataLocation::Storage, &_type); | ||||
| 	DataLocation typeLocation = DataLocation::Storage; | ||||
| 	if (auto refType = dynamic_cast<ReferenceType const*>(&_type)) | ||||
| 		typeLocation = refType->location(); | ||||
| 
 | ||||
| 	set<Declaration const*> seenFunctions; | ||||
| 	MemberList::MemberMap members; | ||||
| 	for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts) | ||||
| 		for (UsingForDirective const* ufd: contract->usingForDirectives()) | ||||
| 		{ | ||||
| 			if (ufd->typeName() && *type != *TypeProvider::withLocationIfReference( | ||||
| 				DataLocation::Storage, | ||||
| 			if (ufd->typeName() && _type != *TypeProvider::withLocationIfReference( | ||||
| 				typeLocation, | ||||
| 				ufd->typeName()->annotation().type | ||||
| 			)) | ||||
| 				continue; | ||||
|  | ||||
| @ -0,0 +1,8 @@ | ||||
| // Used to cause ICE | ||||
| contract C { | ||||
|     function f(uint[] calldata x) external pure { | ||||
|         x[1:2].a; | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
| // TypeError: (92-100): Member "a" not found or not visible after argument-dependent lookup in uint256[] calldata slice. | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user