Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cast operator (.as<...>) in expression language prevents errors reporting #1130

Open
Mingun opened this issue Sep 1, 2024 · 1 comment
Open

Comments

@Mingun
Copy link

Mingun commented Sep 1, 2024

Take the following KSY:

meta:
  id: test_type
instances:
  me:
    value: unknown.as<u1>

When .as<u1> part is missing, the error is reported, as it should:

test_type: /instances/me/value:
	error: unable to access 'unknown' in test_type context

... but when it is present, that code is generated:

function TestType(_io, _parent, _root) {
  this._io = _io;
  this._parent = _parent;
  this._root = _root || this;
  this._debug = {};

}
TestType.prototype._read = function() {
}
Object.defineProperty(TestType.prototype, 'me', {
  get: function() {
    if (this._m_me !== undefined)
      return this._m_me;
    this._debug._m_me = {  };
    this._m_me = this.unknown;
    return this._m_me;
  }
});

I checked several fields where expressions is allowed and the same behavior is observed in each case.

@generalmimon
Copy link
Member

#696 is related.

However, it's true that even without #696 the expression could be checked for at least basic errors such as references to unknown fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants