Skip to content

Syntax error when using array slice on a bytes datatype #284

@abarmat

Description

@abarmat

Description
Syntax error when using array slice on a bytes datatype as allowed in Solidity 0.6

Steps to reproduce

Demo.sol

pragma solidity ^0.6.0;

contract Demo {
    event Log(bytes value);

    function log(bytes calldata value) external {
        emit Log(bytes(value[0:10]));
    }
}

Run with:

solium --dir ./contracts

.soliumrc.json

{
  "extends": "solium:recommended",
  "plugins": ["security"],
  "rules": {
    "no-experimental": ["off"],
    "quotes": ["error", "double"],
    "indentation": ["error", 4],
    "linebreak-style": ["error", "unix"],
    "security/no-inline-assembly": ["off"],
    "security/no-low-level-calls": ["off"]
  }
}

Expected behavior
The usage of array slicing on bytes calldata types should not be considered syntax error.

Solidity Documentation
https://solidity.readthedocs.io/en/v0.6.0/types.html#array-slices

Operating System
MacOS

Linter version
1.2.5

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions