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

Alias declaration with invalid type panics on an unwrap #1305

Open
mhasel opened this issue Sep 10, 2024 · 0 comments
Open

Alias declaration with invalid type panics on an unwrap #1305

mhasel opened this issue Sep 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mhasel
Copy link
Member

mhasel commented Sep 10, 2024

Describe the bug
The following example will hit an unwrap in

if let Some(ref initializer) = variable.initializer {
let type_lhs = context.index.find_type(inner_ty_name).unwrap();
let type_rhs = context.annotations.get_type(initializer, context.index).unwrap();
validate_pointer_assignment(context, validator, type_lhs, type_rhs, &initializer.location);
}

when the declared type does not exist.

To Reproduce
try to compile with --check:

VAR_GLOBAL 
    y: BOOL;
END_VAR

FUNCTION main 
VAR
    x AT y : SomeUndefinedType;
END_VAR

END_FUNCTION

Expected behavior
A diagnostic with Unknown type: SomeUndefinedType

@mhasel mhasel added the bug Something isn't working label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant