tomitrescak / clara-support

0 stars 0 forks source link

Creating the same variable with a different type should not be allowed #100

Closed antonwsu closed 3 years ago

antonwsu commented 3 years ago

Below is an adaptation of the code submitted by one of the students for AUT 2021/ 6.1. In this code the variable is first declared as int and then declared again as String. Its value is successfully reset with readString and is then treated as an int to repeat putting leaves in the loop. This code compiles and runs, while it shouldn't.

class MyClara extends Clara {

int length = 0;

void run()
{        
    String length = readString("Enter length of cake: ");

    for (int i = 0; i < length; i++ )
    {
        putLeaf();
        move();
    }
}

}

tomitrescak commented 3 years ago

Hi, I got a fix, but give me a week to properly test staging ... if you can meanwhile also use staging to tell me if there are any issues. I got a LOT of new functionality ready and I'll show it to you next time you have a bit of time

antonwsu commented 3 years ago

Staging seems to be broken at the moment. I can't run the major assignment (nothing happens with I press "run"). There are also compilation issues with for-loops (see the picture below). Screen Shot 2021-07-26 at 11 41 25 am

antonwsu commented 3 years ago

The current version (production) is quite stable, so, maybe, it's best to wait until the end of the semester (or at least until the mid-semester break) to push your latest changes to production. The issue described at the top (resetting the variable type) is not dramatic. There is only one thing left to fix for this semester: https://github.com/tomitrescak/clara-support/issues/91. Everything else can wait until the break.

tomitrescak commented 3 years ago

Closing this for now as it seems to be fixed, #91 was adressed without the need of deployment.