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

Unable to report an undeclared type behind a type-def at the proper location #1344

Open
mhasel opened this issue Oct 18, 2024 · 0 comments
Open

Comments

@mhasel
Copy link
Member

mhasel commented Oct 18, 2024

When parsing a type-def, we currently only store the name of the referenced type in the generated DataTypeDeclaration. If the aliased type does not exist, it is currently not possible to get back to the source-location of the definition, since we do not have a matching DataType in the index.
This leads to bad UX when validating undefined types, since the error messages shows on the user-type instead of where the actual error happened.
Additionally, ideally we would show such a validation for type-defs only once, instead of once per encountered user-type.

Here's an example:

TYPE myType : undeclaredType; END_TYPE
VAR_GLOBAL
    a: myType;
END_VAR

leads to

error[E052]: Unknown type: myType
      ┌─ demo.st:4:16
      │
    4 │             a: myType;
      │                ^^^^^^ Unknown type: myType
@mhasel mhasel changed the title Unable to report an undeclared type if it is behind an type-def Unable to report an undeclared type behind a type-def at the proper location Oct 18, 2024
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

No branches or pull requests

1 participant