Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Language Features:
* General: Add a builtin that computes the base slot of a storage namespace using the `erc7201` formula from ERC-7201.
* Custom Storage Layout: Allow signed positive expressions.

Compiler Features:
* Commandline Interface: Disallow selecting the deprecated assembly input mode that was only accessible via `--assemble` instead of treating it as equivalent to `--strict-assembly`.
Expand Down
12 changes: 0 additions & 12 deletions libsolidity/analysis/PostTypeContractLevelChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,6 @@ void PostTypeContractLevelChecker::checkStorageLayoutSpecifier(ContractDefinitio
return;
}

if (!baseSlotExpressionType->isImplicitlyConvertibleTo(*TypeProvider::uint256()))
{
m_errorReporter.typeError(
1481_error,
baseSlotExpression.location(),
fmt::format(
"Base slot expression of type '{}' is not convertible to uint256.",
baseSlotExpressionType->humanReadableName()
)
);
return;
}
storageLayoutSpecifier->annotation().baseSlot = u256(baseSlot);

bigint size = contractStorageSizeUpperBound(_contract, VariableDeclaration::Location::Unspecified);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
int constant x = -42;
int8 constant y = -64;
contract C layout at x {}
contract D layout at y {}
// ----
// TypeError 6753: (66-67): The base slot of the storage layout evaluates to -42, which is outside the range of type uint256.
// TypeError 6753: (92-93): The base slot of the storage layout evaluates to -64, which is outside the range of type uint256.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int constant x = 42;
int16 constant y = 64;
contract C layout at x {}
contract D layout at y {}
// ----
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
int constant SIGNED2 = 2;
int constant SIGNED2_NEGATIVE = -2;
uint constant UNSIGNED2 = 2;

contract A layout at SIGNED2 * 1 {}
contract B layout at SIGNED2_NEGATIVE * -1 {}
contract C layout at SIGNED2_NEGATIVE * SIGNED2_NEGATIVE {}
contract D layout at 2 * -1 * -1 {}
contract E layout at 2 * SIGNED2 {}
contract F layout at 2 * -1 * SIGNED2_NEGATIVE {}
// ----