Skip to content

Add warning for return x in spawn context#228

Merged
spookydonut merged 1 commit intoSpaceManiac:masterfrom
pali6:warn-return-value-in-spawn
Nov 24, 2020
Merged

Add warning for return x in spawn context#228
spookydonut merged 1 commit intoSpaceManiac:masterfrom
pali6:warn-return-value-in-spawn

Conversation

@pali6
Copy link
Copy Markdown
Contributor

@pali6 pali6 commented Nov 5, 2020

As far as I know doing return something in a spawn context is always equivalent to just returning without a value and as such it is probably a mistake so let's warn people about it.

},
Statement::Return(Some(expr)) => {
// TODO: factor in the previous return type if there was one
if self.inside_newcontext > 0 {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC isn't this also set in waitfor = 0 procs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, the only place that changes inside_newcontext to non-zero values seems to be the Statement::Spawn match arm.

@spookydonut spookydonut changed the title Adds warning for return x in spawn context Add warning for return x in spawn context Nov 24, 2020
@spookydonut spookydonut merged commit 650daa0 into SpaceManiac:master Nov 24, 2020
@SpaceManiac SpaceManiac added this to the suite v1.7 milestone Dec 9, 2020
j-awn pushed a commit to j-awn/SpacemanDMM that referenced this pull request Apr 1, 2021
@pali6 pali6 deleted the warn-return-value-in-spawn branch February 7, 2022 18:10
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.

4 participants