UoY-RoboStar / robochart-textual

This repository contains the plugins for the RoboChart textual editor
Eclipse Public License 2.0
0 stars 1 forks source link

Scope for transitions is too wide #76

Closed pefribeiro closed 11 months ago

pefribeiro commented 1 year ago

It seems the scoping for source/target of transitions does not prevent a transition from being defined in a NodeContainer that does not contain both the source and target of the transition. While we have a WFC that prevents interlevel transitions, it is not sufficient to rule out this case. Minimal example below.

stm STM {
    initial I
    state S0 {
        initial I
        final F
        transition T2 { from I to F }       
        transition T3 { from S0 to S3 }
    }
    state S3 {

    }
    transition T0 { from I to S0 }
}

This does not generate an error, but causes issues with the CSP generator, because it assumes this is not possible. Usually this problem would not surface if using just the graphical editor, but refactoring, ie. moving states/transitions around can result in this situation. I suspect the problem is because of the delegateScope call in resolving the target/transition scopes:

https://github.com/UoY-RoboStar/robochart-textual/blob/5107c44db07f44457a3faee888de2b516ee795f1/circus.robocalc.robochart.textual/src/circus/robocalc/robochart/textual/scoping/RoboChartScopeProvider.xtend#L230