anoniscoding / yorlang

A programming language with yoruba language construct
https://anoniscoding.github.io/yorlang/
MIT License
450 stars 70 forks source link

Error in tàbí ṣé conditionals #38

Closed mykeels closed 5 years ago

mykeels commented 5 years ago

Describe the bug

I tried writing the following function:

ise muIseju(iseju) {
    ṣé (iseju > 30) {
        pada BEFOREPOINTER + muNọmbaWa(60 - iseju);
    }
    tàbí ṣé (iseju < 30) {
        pada AFTERPOINTER + muNọmbaWa(iseju);
    }
    tàbí {
        pada aabo;
    }
}

There's already an imported constants.yl file with a function definition for muNọmbaWa, and variable declarations for BEFOREPOINTER, AFTERPOINTER and aabo.

To Reproduce Steps to reproduce the behavior:

  1. When I supply 22 as an argument, I get undefined as its return value, but 32 as an argument returns Ku iseju Mejidinlogbon which is fine.

  2. If I flip the logic, and specify < before >, then 22 works and 32 does not.

  3. If I rewrite as nested if-else statements, then it works well.

    ṣé (iseju < 30) {
        pada AFTERPOINTER + muNọmbaWa(iseju);
    }
    tàbí {
        ṣé (iseju > 30) {
            pada BEFOREPOINTER + muNọmbaWa(60 - iseju);
        }
        tàbí {
            pada aabo;
        }
    }

Expected behavior ṣé and tàbí ṣé should work.

anoniscoding commented 5 years ago

Thank you very much for pointing this out, i've found the bug. Nice eyes bro, more catches in the future. I will be making a PR to close this issue

anoniscoding commented 5 years ago

So i've fixed the bug. The fix is in version 1.0.9 on yorlang npm. Once again, thank you