Skip to content

Commit

Permalink
Reduce number of generated error messages
Browse files Browse the repository at this point in the history
"Reference to name ..." and "Reference to type ..." messages are
suppressed if there is alerady an error for the same location
  • Loading branch information
PaulKlint committed Mar 11, 2024
1 parent c69ae5f commit c8226f5
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/analysis/typepal/Solver.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -1502,8 +1502,13 @@ Solver newSolver(map[str,Tree] namedTrees, TModel tm){
tm.config.postSolver(namedTrees, thisSolver);

// Convert all FaillMessages into Messages
error_locations = {};
for(fm <- failMessages){
messages += toMessage(fm, getType);
msg = toMessage(fm, getType);
if(error(_,src) := msg){
error_locations += src;
}
messages += msg;
}

for(Use u <- openUses){
Expand All @@ -1523,9 +1528,13 @@ Solver newSolver(map[str,Tree] namedTrees, TModel tm){
for(rp <- referPaths){
switch(rp){
case referToDef(_, _):
messages += error("Reference to name `<rp.use.id>` cannot be resolved", rp.use.occ);
if(rp.use.occ notin error_locations){
messages += error("Reference to name `<rp.use.id>` cannot be resolved", rp.use.occ);
}
case referToType(occ, _, _):
messages += error("Reference to type definition cannot be resolved", occ);
if(occ notin error_locations){
messages += error("Reference to type definition cannot be resolved", occ);
}
}
}

Expand Down Expand Up @@ -1581,7 +1590,6 @@ Solver newSolver(map[str,Tree] namedTrees, TModel tm){
reportedLocations += src;
}
}

}

tm.calculators = calculators;
Expand Down

0 comments on commit c8226f5

Please sign in to comment.