Skip to content

Commit

Permalink
Change listAppend notification to warning.
Browse files Browse the repository at this point in the history
- Change listAppend notification to warning to make it fail during
  bootstrapping and avoid people pushing such code in.
  • Loading branch information
perost committed Sep 25, 2020
1 parent 48df8bf commit c317ec8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions OMCompiler/Compiler/Script/InteractiveUtil.mo
Expand Up @@ -15561,12 +15561,11 @@ algorithm
end try;
allPaths := {};
for pt in fqpaths loop
allPaths := listAppend(allPaths, getAllInheritedClasses(pt, p));
allPaths := List.unique(allPaths);
allPaths := List.append_reverse(getAllInheritedClasses(pt, p), allPaths);
end for;
fqpaths := listAppend(fqpaths, allPaths);
allPaths := Dangerous.listReverseInPlace(List.unique(allPaths));
then
fqpaths;
listAppend(fqpaths, allPaths);

else {};
end matchcontinue;
Expand Down
2 changes: 1 addition & 1 deletion OMCompiler/Compiler/Util/Error.mo
Expand Up @@ -1116,7 +1116,7 @@ public constant ErrorTypes.Message DUPLICATE_DEFINITION = ErrorTypes.MESSAGE(503
Gettext.gettext("The same variable is being defined twice: %s."));
public constant ErrorTypes.Message PATTERN_VAR_NOT_VARIABLE = ErrorTypes.MESSAGE(5038, ErrorTypes.TRANSLATION(), ErrorTypes.ERROR(),
Gettext.gettext("Identifiers need to point to local or output variables. Variable %s is %s."));
public constant ErrorTypes.Message LIST_REVERSE_WRONG_ORDER = ErrorTypes.MESSAGE(5039, ErrorTypes.TRANSLATION(), ErrorTypes.NOTIFICATION(),
public constant ErrorTypes.Message LIST_REVERSE_WRONG_ORDER = ErrorTypes.MESSAGE(5039, ErrorTypes.TRANSLATION(), ErrorTypes.WARNING(),
Gettext.gettext("%1:=listAppend(%1, _) has the first argument in the \"wrong\" order.\n It is very slow to keep appending a linked list (scales like O(N²)).\n Consider building the list in the reverse order in order to improve performance (scales like O(N) even if you need to reverse a lot of lists). Use annotation __OpenModelica_DisableListAppendWarning=true to disable this message for a certain assignment."));
public constant ErrorTypes.Message IS_PRESENT_WRONG_SCOPE = ErrorTypes.MESSAGE(5040, ErrorTypes.TRANSLATION(), ErrorTypes.ERROR(),
Gettext.gettext("isPresent needs to be called from a function scope, got %s."));
Expand Down

0 comments on commit c317ec8

Please sign in to comment.