Git Product home page Git Product logo

Comments (4)

tintinweb avatar tintinweb commented on June 3, 2024

Hmm, that's weird 🤔 This should throw a declaration error the first time you re-declare a variable.

image

I don't seem to be able to reproduce this. Could it be that the error is delayed from the first instance of the re-declaration? (maybe delayed by ganache; error location matches mine in the screenshot). Can you check the output of .dump after you re-declare b (this is what's being evaluated)?

Also, note that delete <var> will reset its value to default (zero for unit) and not undeclare it. You'll still get a declaration error if you attempt to declare the variable again.

from solidity-shell.

x676f64 avatar x676f64 commented on June 3, 2024

Sure, here you go. It appears you're right. It's just not triggering an error the first time.

🚀 Entering interactive Solidity shell. '.help' and '.exit' are your friends.
 »  ℹ️  ganache-mgr: starting temp. ganache instance ...
 »
 »  uint a = 1101*10**18
 »  uint b = 310*10**18
 »  a/b
3
 »  uint a = 11*10**22
 »  uint b = 310*10**22
[
  {
    component: 'general',
    errorCode: '2333',
    formattedMessage: 'DeclarationError: Identifier already declared.\n' +
      'Note: The previous declaration is here:\n' +
      '\n',
    message: 'Identifier already declared.',
    secondarySourceLocations: [ [Object] ],
    severity: 'error',
    sourceLocation: { end: 219, file: '', start: 213 },
    type: 'DeclarationError'
  }
]
 »  .dump
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.7;



contract MainContract {



    function main() public  {
        uint a = 1101*10**18;
        uint b = 310*10**18;
        a/b;
        return ;
    }
}

from solidity-shell.

tintinweb avatar tintinweb commented on June 3, 2024

Hey 🙌 ,

just published a new version that may fix an issue where an error wasn't returned even though it should. Can you give it a try?

Else, would be great if you could just run ganache-cli in another shell window, keep the console open. then start solidity-shell which should connect to your running ganache instance. Now try to reproduce the issue and check if there is a delay between solidity-shell and the ganache rpc calls. It does not reproduce on my local machine (macos) but if we can track it down I might be able to check what's going wrong :)

cheers

from solidity-shell.

tintinweb avatar tintinweb commented on June 3, 2024

I'm closing this for now. feel free to reopen if you have more information on how to reproduce. thanks!

from solidity-shell.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.