-
Notifications
You must be signed in to change notification settings - Fork 53
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
feat: add additional pointer and type validations #1341
Conversation
@@ -1628,6 +1628,9 @@ impl Index { | |||
if let DataTypeInformation::Pointer { inner_type_name, .. } = initial_type { | |||
if let Some(ty) = self.find_effective_type_info(inner_type_name) { | |||
return self.find_elementary_pointer_type(self.find_intrinsic_type(ty)); | |||
} else { | |||
// the inner type can't be found, return VOID as placeholder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fixes a stack-overflow in typesystem::is_same_type_class
when dealing with pointers of undefined type
a13293b
to
d8ce876
Compare
d8ce876
to
7a1d890
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
@@ -746,6 +746,7 @@ fn parse_pointer_definition( | |||
( | |||
DataTypeDeclaration::DataTypeDefinition { | |||
data_type: DataType::PointerType { name, referenced_type: Box::new(decl), auto_deref }, | |||
// FIXME: this currently includes the initializer in the sourcelocation, resulting in 'REF_TO A := B' when creating a slice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we track this on GitHub instead in the code itself? I feel like these FIXMEs are easily forgotten
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I've already set up a draft for this issue - just need to add a reproducible example.
4 │ a: myDeclaredType; | ||
│ ^^^^^^^^^^^^^^ Unknown type: myDeclaredType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already talked about this yesterday offline, but the UX isn't good here; maybe we should also track this in a issue seperately and see if there's a solution to this (minor however)
This commit adds some additional type validations for pointer variables being initialized with
ADR
/REF
.Also adds a validation to catch undeclared types, previously only reported during codegen.