summaryrefslogtreecommitdiff
path: root/modules/gdscript/tests/scripts/analyzer/features/hard_variants.gd
blob: 48a804ff54a8b339d2525c4a7dc235eaa3a369c1 (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
func variant() -> Variant: return null

var member_weak = variant()
var member_typed: Variant = variant()
var member_inferred := variant()

func param_weak(param = variant()) -> void: print(param)
func param_typed(param: Variant = variant()) -> void: print(param)
func param_inferred(param := variant()) -> void: print(param)

func return_untyped(): return variant()
func return_typed() -> Variant: return variant()

@warning_ignore("unused_variable")
func test() -> void:
	var weak = variant()
	var typed: Variant = variant()
	var inferred := variant()

	weak = variant()
	typed = variant()
	inferred = variant()

	param_weak(typed)
	param_typed(typed)
	param_inferred(typed)

	if typed == null: pass
	if typed != null: pass
	if typed is Node: pass

	print('ok')