Skip to content

Commit

Permalink
Report offending modules when invertUnique fails
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulKlint committed Jan 12, 2025
1 parent 23689a0 commit ce38196
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/analysis/typepal/Collector.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import Location;
import String;

import analysis::typepal::Version;
import analysis::typepal::Messenger;

extend analysis::typepal::ConfigurableScopeGraph;
extend analysis::typepal::ICollector;
Expand Down Expand Up @@ -253,7 +254,21 @@ TModel convertTModel2PhysicalLocs(TModel tm){
TModel convertTModel2LogicalLocs(TModel tm, map[str,TModel] tmodels){
if(tm.usesPhysicalLocs){
tmodels[tm.modelName] = tm;
physical2logical = invertUnique((() | it + tm1.logical2physical | tm1 <- range(tmodels)));
physical2logical = ();
try {
physical2logical = invertUnique((() | it + tm1.logical2physical | tm1 <- range(tmodels)));
} catch MultipleKey(value physLoc, value _, value _):{
where = loc l := physLoc ? l : |unknown:///|;
// find the offending modules
mnames = {};
for(mname <- domain(tmodels)){
if(physLoc in range(tmodels[mname].logical2physical)){
mnames += mname;
}
}
tm.messages += error("Please recheck modules <intercalateAnd(toList(mnames))>; their mapping from physical to logical locations is outdated", where);
return tm;
}
logical2physical = tm.logical2physical;
tm.logical2physical = ();
tm = convertLocs(tm, physical2logical);
Expand Down

0 comments on commit ce38196

Please sign in to comment.