Opened 10 years ago
Last modified 10 years ago
#3063 closed defect
MetaModelica string match issues — at Version 1
Reported by: | Adrian Pop | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | high | Milestone: | 1.9.2 |
Component: | MetaModelica | Version: | trunk |
Keywords: | Cc: |
Description (last modified by )
The match below will fail when ident is "IncludeDirectory", it will not return "bad".
ident := "IncludeDirectory"; x := match ident case "choices" then ""; case "Documentation" then ""; case "Dialog" then ""; case "Diagram" then ""; case "Icon" then ""; case "Line" then ""; case "Placement" then ""; case "preferredView" then ""; case "conversion" then ""; case "defaultComponentName" then ""; case "revisionId" then ""; case "uses" then ""; else then "bad"; end match;
This happens because the match is transformed to switch on the hash of the string and after the case is selected a comparison is made and if the comparison fails it jumps directly to the end of the switch. It should jump to the default case of the switch if the string comparison fails.
Note:
See TracTickets
for help on using tickets.