Skip to content

Commit

Permalink
🐛 Fix remappings priority rule
Browse files Browse the repository at this point in the history
  • Loading branch information
michprev committed Jul 18, 2023
1 parent d2aa29a commit e7820d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion woke/compiler/source_unit_name_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def apply_remapping(self, parent_source_unit: str, source_unit_name: str) -> str
if len(matching_remappings) == 0:
return source_unit_name

matching_remappings.sort(key=lambda r: len(r.context or ""), reverse=True)
# longest prefix wins, if there are multiple remappings with the same prefix, choose the last one
matching_remappings.sort(key=lambda r: len(r.prefix), reverse=True)

# choose the remapping with the longest context
# if there are multiple remappings with the same context, choose the last one
Expand Down

0 comments on commit e7820d4

Please sign in to comment.