Skip to content

Accept filename and fileName in omc messages - #487

Open
adrpo wants to merge 1 commit into
OpenModelica:masterfrom
adrpo:accept-filename-and-fileName
Open

adrpo wants to merge 1 commit into
OpenModelica:masterfrom
adrpo:accept-filename-and-fileName

Conversation

@adrpo

@adrpo adrpo commented Nov 6, 2026

Copy link
Copy Markdown
Member

Related issues

OpenModelica/OpenModelica#17891, OpenModelica/OpenModelica#17893.

Purpose

OpenModelica/OpenModelica#17893 changes the field of the file name in the messages of getMessagesStringInternal() from filename to fileName, the name of the declared record OpenModelica.Scripting.SourceInfo. The other fields are camel case too (lineStart, columnStart, ...).

OMCSessionABC.sendExpression parses these messages with a regex that accepts only filename = "...". With a newer omc, no message is parsed: OMPython logs "Invalid ErrorMessage record" for each one, and an omc error does not raise OMSessionException.

Approach

  • The regex accepts filename and fileName, so OMPython works with older and newer omc versions.
  • New test test_error_message_file: loadString with a syntax error and the file name bad.mo must raise OMSessionException with [bad.mo: in the message.

Tests

An AI agent (Claude Code) wrote this change and ran the tests above locally (Linux).


🤖 Generated with Claude Code

getMessagesStringInternal() prints the file of a message as
filename = "..." in older omc versions and as fileName = "..." after
OpenModelica/OpenModelica#17893 (issue OpenModelica/OpenModelica#17891).
With only filename in the regex, the messages of a newer omc are not
parsed, and an omc error does not raise OMSessionException.

Accept both names. The new test checks that an omc error raises
OMSessionException with the file name of the message.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant