summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/warnings/redundant_await.gd
blob: f8844d66a7799991546a7efb854f78de89a39e10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
signal my_signal()

# CI cannot test async things.
func test_signals():
	await my_signal
	var t: Signal = my_signal
	await t

func coroutine() -> void:
	@warning_ignore("redundant_await")
	await 0

func not_coroutine_variant():
	pass

func not_coroutine_void() -> void:
	pass

func test():
	const CONST_NULL = null
	var var_null = null
	var var_int: int = 1
	var var_variant: Variant = 1
	var var_array: Array = [1]

	await CONST_NULL
	await var_null
	await var_int
	await var_variant
	await var_array[0]

	await coroutine
	await coroutine()
	await coroutine.call()
	await self.coroutine()
	await call(&"coroutine")

	await not_coroutine_variant
	await not_coroutine_variant()
	await self.not_coroutine_variant()
	await not_coroutine_variant.call()
	await call(&"not_coroutine_variant")

	await not_coroutine_void
	await not_coroutine_void()
	await self.not_coroutine_void()
	await not_coroutine_void.call()
	await call(&"not_coroutine_void")

	var callable: Callable = coroutine
	await callable
	await callable.call()
	await callable.get_method()