Skip to content

fix: handle void to void during convertExpression #2412

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

Merged
merged 5 commits into from
Aug 21, 2022

Conversation

HerrCai0907
Copy link
Member

@HerrCai0907 HerrCai0907 commented Aug 6, 2022

Fix: #2205

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@HerrCai0907 HerrCai0907 changed the title handle void to void during convertExpression fix: handle void to void during convertExpression Aug 6, 2022
Co-authored-by: Max Graey <maxgraey@gmail.com>
@MaxGraey MaxGraey requested a review from dcodeIO August 6, 2022 15:06
@dcodeIO
Copy link
Member

dcodeIO commented Aug 6, 2022

Iirc the idea of the assert is that if one converts nothing to nothing, then there isn't an expression to begin with that can be consumed as part of the conversion. Conceptionally, this would be a drop of a drop, but there's nothing to drop, so nothing to produce. As such I wonder if hitting the assertion in the first place is a sign that other code does something wrong prior?

@MaxGraey
Copy link
Member

MaxGraey commented Aug 6, 2022

Yeah, btw (drop (drop (...))) is not valid operation. But it's not possible on practice due to drop has [any] -> [] signature. Or I missing something? Also on user space we can't produce explicit drops

@MaxGraey
Copy link
Member

MaxGraey commented Aug 6, 2022

Perhaps we should add new UNKNOWN type kind as a top type which always should be resolved at the end (or at first access). In this case we could distinguish VOID from uninit expressions better for such cases

@HerrCai0907
Copy link
Member Author

HerrCai0907 commented Aug 6, 2022

As such I wonder if hitting the assertion in the first place is a sign that other code does something wrong prior?

@dcodeIO Because it used a un-initialized Global and throw Diagnosis before. So the this.currentType become VOID.

@HerrCai0907
Copy link
Member Author

@dcodeIO What is your opinion about this PR?

@dcodeIO
Copy link
Member

dcodeIO commented Aug 21, 2022

Tried to come up with a comment so, in case we ever run into issues here, we know what was the intention :)

Co-authored-by: dcode <dcode@dcode.io>
@MaxGraey MaxGraey merged commit 707fc7a into AssemblyScript:main Aug 21, 2022
@MaxGraey
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Declaration that gets the typeof itself crashes the compiler
3 participants