mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix ICE by avoiding copyForLocation() on ArraySliceType
This commit is contained in:
parent
5fedb4eab0
commit
b3cafe4583
@ -13,6 +13,7 @@ Compiler Features:
|
|||||||
Bugfixes:
|
Bugfixes:
|
||||||
* Optimizer: Fixed a bug in BlockDeDuplicator.
|
* Optimizer: Fixed a bug in BlockDeDuplicator.
|
||||||
* Type Checker: Disallow assignments to storage variables of type ``mapping``.
|
* 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.
|
* NatSpec: DocString block is terminated when encountering an empty line.
|
||||||
* Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL.
|
* Scanner: Fix bug when two empty NatSpec comments lead to scanning past EOL.
|
||||||
* Code Generator: Trigger proper unimplemented errors on certain array copy operations.
|
* 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 (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.
|
// Try to see if the member was removed because it is only available for storage types.
|
||||||
auto storageType = TypeProvider::withLocationIfReference(
|
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)
|
MemberList::MemberMap Type::boundFunctions(Type const& _type, ContractDefinition const& _scope)
|
||||||
{
|
{
|
||||||
// Normalise data location of type.
|
// 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;
|
set<Declaration const*> seenFunctions;
|
||||||
MemberList::MemberMap members;
|
MemberList::MemberMap members;
|
||||||
for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts)
|
for (ContractDefinition const* contract: _scope.annotation().linearizedBaseContracts)
|
||||||
for (UsingForDirective const* ufd: contract->usingForDirectives())
|
for (UsingForDirective const* ufd: contract->usingForDirectives())
|
||||||
{
|
{
|
||||||
if (ufd->typeName() && *type != *TypeProvider::withLocationIfReference(
|
if (ufd->typeName() && _type != *TypeProvider::withLocationIfReference(
|
||||||
DataLocation::Storage,
|
typeLocation,
|
||||||
ufd->typeName()->annotation().type
|
ufd->typeName()->annotation().type
|
||||||
))
|
))
|
||||||
continue;
|
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