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

GDScript: Fix checking if a call is awaited in compiler #74147

Merged

Conversation

vonagam
Copy link
Contributor

@vonagam vonagam commented Mar 1, 2023

Currently all calls inside an awaited expression are treated as if they were awaited but only top one really is.

So in await one(two()) - one is truly awaited, two should not think that it is.

Example:

func coroutine(input: Variant):
  await get_tree().create_timer(0.1).timeout
  return [input]

func _ready():
  print(await coroutine((self as Variant).coroutine('bad'))) # before: [GDScriptFunctionState], after: error
  print(await coroutine(await coroutine('good'))) # before: error, after: [["good"]]

@vonagam vonagam requested a review from a team as a code owner March 1, 2023 07:16
@vonagam vonagam force-pushed the fix-call-await-check-in-compiler branch from 594abe3 to 55a2ad2 Compare March 1, 2023 07:31
@akien-mga akien-mga added this to the 4.1 milestone Mar 1, 2023
@akien-mga akien-mga merged commit a0134f7 into godotengine:master Mar 5, 2023
13 checks passed
@akien-mga
Copy link
Member

Thanks!

@vonagam vonagam deleted the fix-call-await-check-in-compiler branch March 5, 2023 12:46
@YuriSizov
Copy link
Contributor

Cherry-picked for 4.0.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants