Skip to content

Incorrect "This declaration shadows and existing declaration" warning for mutually inaccesible declarations #16190

@Philogy

Description

@Philogy

Description

I get shadow declaration warnings for variable definitions that are defined in separate scopes. That cannot possible refer to each other.

Environment

  • Compiler version: 0.8.29
  • Compilation pipeline (legacy, IR, EOF): legacy
  • Target EVM version (as per compiler settings): cancun
  • Framework/IDE (e.g. Foundry, Hardhat, Remix): foundryj
  • Operating system: MacOS

Steps to Reproduce

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract Bob {
    function myFunc() external view returns (uint256) {
        {
            uint256 x = 34;
            x -= address(this).balance;
        }

        uint256 x = 33 + 2;
        return x;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions