trufflesuite / trufflesuite.github.io

Staging Repo of Build Artifacts for Truffle Suite. Find the source at https://github.com/trufflesuite/trufflesuite.com
https://www.trufflesuite.com
34 stars 161 forks source link

Warning for Assert.sol - shadows an existing declaration #179

Closed designium closed 6 years ago

designium commented 6 years ago

I am doing the Pet Shop example and in the test part of the tutorial, the truffle test gives back the following warnings:

Using network 'development'.

    Compiling ./contracts/Adoption.sol...
    Compiling ./test/TestAdoption.sol...
    Compiling truffle/Assert.sol...
    Compiling truffle/DeployedAddresses.sol...

    Compilation warnings encountered:

    truffle/Assert.sol:114:20: Warning: This declaration shadows an existing declaration.
        function equal(string A, string B, string message) constant returns (bool result) {
                       ^------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:137:23: Warning: This declaration shadows an existing declaration.
        function notEqual(string A, string B, string message) constant returns (bool result) {
                          ^------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:206:20: Warning: This declaration shadows an existing declaration.
        function equal(bytes32 A, bytes32 B, string message) constant returns (bool result) {
                       ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:226:23: Warning: This declaration shadows an existing declaration.
        function notEqual(bytes32 A, bytes32 B, string message) constant returns (bool result) {
                          ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:286:20: Warning: This declaration shadows an existing declaration.
        function equal(address A, address B, string message) constant returns (bool result) {
                       ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:305:23: Warning: This declaration shadows an existing declaration.
        function notEqual(address A, address B, string message) constant returns (bool result) {
                          ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:403:20: Warning: This declaration shadows an existing declaration.
        function equal(bool A, bool B, string message) constant returns (bool result) {
                       ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:426:23: Warning: This declaration shadows an existing declaration.
        function notEqual(bool A, bool B, string message) constant returns (bool result) {
                          ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:451:20: Warning: This declaration shadows an existing declaration.
        function equal(uint A, uint B, string message) constant returns (bool result) {
                       ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:474:23: Warning: This declaration shadows an existing declaration.
        function notEqual(uint A, uint B, string message) constant returns (bool result) {
                          ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:497:22: Warning: This declaration shadows an existing declaration.
        function isAbove(uint A, uint B, string message) constant returns (bool result) {
                         ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:520:24: Warning: This declaration shadows an existing declaration.
        function isAtLeast(uint A, uint B, string message) constant returns (bool result) {
                           ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:543:22: Warning: This declaration shadows an existing declaration.
        function isBelow(uint A, uint B, string message) constant returns (bool result) {
                         ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:566:23: Warning: This declaration shadows an existing declaration.
        function isAtMost(uint A, uint B, string message) constant returns (bool result) {
                          ^----^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:635:20: Warning: This declaration shadows an existing declaration.
        function equal(int A, int B, string message) constant returns (bool result) {
                       ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:658:23: Warning: This declaration shadows an existing declaration.
        function notEqual(int A, int B, string message) constant returns (bool result) {
                          ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:681:22: Warning: This declaration shadows an existing declaration.
        function isAbove(int A, int B, string message) constant returns (bool result) {
                         ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:704:24: Warning: This declaration shadows an existing declaration.
        function isAtLeast(int A, int B, string message) constant returns (bool result) {
                           ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:727:22: Warning: This declaration shadows an existing declaration.
        function isBelow(int A, int B, string message) constant returns (bool result) {
                         ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:750:23: Warning: This declaration shadows an existing declaration.
        function isAtMost(int A, int B, string message) constant returns (bool result) {
                          ^---^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:1267:27: Warning: This declaration shadows an existing declaration.
        function balanceEqual(address A, uint b, string message) constant returns (bool result) {
                              ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:1287:30: Warning: This declaration shadows an existing declaration.
        function balanceNotEqual(address A, uint b, string message) constant returns (bool result) {
                                 ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:1306:28: Warning: This declaration shadows an existing declaration.
        function balanceIsZero(address A, string message) constant returns (bool result) {
                               ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

    ,truffle/Assert.sol:1325:31: Warning: This declaration shadows an existing declaration.
        function balanceIsNotZero(address A, string message) constant returns (bool result) {
                                  ^-------^
    truffle/Assert.sol:64:5: The shadowed declaration is here:
        uint8 constant A = uint8(byte('a'));
        ^---------------------------------^

Does it help if we change the comparison from that to:

uint32 constant A = uint32(byte('a')); 

??

Tomasvrba commented 6 years ago

Just going through the tutorial myself and getting the same warnings. Is this anything to worry about?

arkryonia commented 6 years ago

Same thing for me.

howtomakeaturn commented 6 years ago

same here. why the warning message comes out?

HaleTom commented 6 years ago

Work around:

yarn global add truffle@beta
bmmpxf commented 6 years ago

Hi there all. This tutorial has been updated and this issue should not be there anymore. Please give it another try!

http://truffleframework.com/tutorials/pet-shop

aaronmboyd commented 6 years ago

@bmmpxf What was the change? Because I'm getting it in a personal project as well.