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

void is incorrectly convertible to Object #302

Closed
7 tasks
degory opened this issue Aug 23, 2020 · 0 comments · Fixed by #922
Closed
7 tasks

void is incorrectly convertible to Object #302

degory opened this issue Aug 23, 2020 · 0 comments · Fixed by #922
Labels

Comments

@degory
Copy link
Owner

degory commented Aug 23, 2020

void is treated as assignment compatible to Object, which is incorrect and results in invalid CIL.

Attempting to operate on void values as if they were instances of Object should result in an error.

Provided #914, #915 and #916 are fixed, the only way to generate a value of void type will be calls to functions returning void. However, it's probably more straightforward to check for void values on consumption rather than production, given that calling void returning functions is obviously fine, provided the result is discarded without being used.

The following should all produce compile time errors:

  • Assignment from a void value
  • Passing a void value into a function call as an argument
  • Passing a void value to a built in operator
  • Passing a void value to a user defined operator function
  • Attempting to access a member of a void value
  • Checking if a value of void type is null with the '?' operator
  • Comparing a void value to anything for equality
@degory degory added the bug label Aug 23, 2020
@degory degory added this to the stable milestone Jan 25, 2021
@degory degory removed this from the stable milestone Jan 1, 2022
degory added a commit that referenced this issue Jan 3, 2022
Bugs fixed:
- Void is incorrectly convertible to Object (closes #302)
- No error when declaring symbols of void type (closes #914)
- No error when inheriting from types that are constructed from void (closes #915)
- No error when attempting to create instances of types constructed from void (closes #916)
- No error when attempting to consume values of void type (closes #921)
degory added a commit that referenced this issue Jan 3, 2022
Bugs fixed:
- Void is incorrectly convertible to Object (closes #302)
- No error when declaring symbols of void type (closes #914)
- No error when inheriting from types that are constructed from void (closes #915)
- No error when attempting to create instances of types constructed from void (closes #916)
- No error when attempting to consume values of void type (closes #921)
Repository owner moved this from In Progress to Done in ghūl programming language - stable release Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant