Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hanging the code after unsuccessful **if:is** statement #661

Closed
arakov opened this issue Jun 2, 2024 · 1 comment
Closed

Hanging the code after unsuccessful **if:is** statement #661

arakov opened this issue Jun 2, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@arakov
Copy link
Member

arakov commented Jun 2, 2024

Describe the bug
In the following code the program is not terminated correctly. The code works correctly till the end but the program hangs at the
end.

To Reproduce

import extensions;

class IntWrapper
{ 
    int value;
      
    constructor(int value) 
    {
       this value := value 
    }

    int cast()
       = value;  
}

class MyClass
{
    add(int n)
    {
        console.printLine("add int:(",n,")")
    }
    
    add(string s)
    {
        console.printLine("add literal:(",s,")")
    }
    
    add(o)
    {
        if (o; is int n) {
           ^ self.add(n);
        };

        console.printLine("unsupported")
    }
}

public program()
{
    var o := new MyClass();
    var wrapper := new IntWrapper(4);
    
    o.add("string");
    o.add(2);
    o.add(wrapper);
    o.add(2.3);  // when this line is commented, the code works correctly and ends without a problem
}

Expected behavior
The code must end without hanging indefinitely

@arakov arakov added the bug label Jun 2, 2024
@arakov arakov added this to the ELENA 7.x milestone Jun 2, 2024
@arakov arakov self-assigned this Jun 6, 2024
arakov added a commit that referenced this issue Jun 6, 2024
…he previous catch block is restored and jumped to the end
@arakov
Copy link
Member Author

arakov commented Jun 6, 2024

Fixed in ELENA 6.1.2

@arakov arakov closed this as completed Jun 6, 2024
@arakov arakov mentioned this issue Jun 12, 2024
arakov added a commit that referenced this issue Jun 12, 2024
* #562 : refactoring before adding support for nullable
* #562 : assigning nillable to struct
* #661 : try block with ret expression must have an extra block where the previous catch block is restored and jumped to the end
* MT : fixing an issue with infinite GC wait
* [FIXED] exception handling in a thread
* [FIXED] event handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant