Skip to content

Commit

Permalink
Added type to variable declaration
Browse files Browse the repository at this point in the history
The variable topSort was introduced as `topSort = []` without declared
type. It is assigned in the body of the local function strongConnect.
However, we only do local type inference, not across function
boundaries.

As  a result, at the return of stronglyConnectedComponentsAndTopSort,
the inferred type of topSort is still list[void] and the returned tuple
is rejected by the type checker.
  • Loading branch information
PaulKlint committed Mar 24, 2024
1 parent cf9c0d1 commit a26d384
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/rascalmpl/library/analysis/graphs/Graph.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ tuple[set[set[&T]], list[&T]] stronglyConnectedComponentsAndTopSort(Graph[&T] g
set[&T] onStack = {}; // set of nodes on current stack
list[&T] stack = []; // node stack contains nodes of SCC under construction
components = {}; // set of SCCs to be constructed
topsort = [];
set[set[&T]]components = {};// set of SCCs to be constructed
list[&T] topsort = []; // sorted list of elements
void strongConnect(&T v){
// Set the depth index for v to the smallest unused index
Expand Down

0 comments on commit a26d384

Please sign in to comment.