goost icon indicating copy to clipboard operation
goost copied to clipboard

Assigning any value to `LinkedList.front` directly results in an error

Open Xrayez opened this issue 5 years ago • 1 comments

Goost and Godot version: gd3 @ 455ebc02a2268aeefce4e0ad066071a8f2f30560, 3.2.

OS/device including version: Windows 10.

Issue description: Attempting to assign any value to LinkedList.front directly results in an error:

'Invalid set index 'front' (on base: 'LinkedList') with value of type 'ListNode'.'

Steps to reproduce:

func test_list_assign_via_front():
	list.push_back("A")
	assert_not_null(list.front)
	assert_eq(list.front.value, "A")

	# FIXME: This doesn't work, throws an error:
	list.front.value = "B"
	assert_eq(list.front.value, "B")

	# But this works:
	var n = list.front
	n.value = "B"
	assert_eq(list.front.value, "B")

	# This also works:
	list.find("A").value = "B"
	assert_eq(list.front.value, "B")

That's really strange because:

  • we never assign any kind of ListNode in the snippet above.
  • the reported base is wrong, should be ListNode.

I've actually stumbled upon this while implementing linked list in #12, but never got to resolve this issue: https://github.com/goostengine/goost/blob/455ebc02a2268aeefce4e0ad066071a8f2f30560/tests/project/goost/core/types/test_list.gd#L597-L616

So, I'm not sure if that's caused by a particular implementation in Goost, or this may actually be a GDScript bug in 3.2, because other workarounds work, I don't understand why it wouldn't work in this case.

Minimal reproduction project: list_assign_front.zip

Xrayez avatar Sep 17 '20 12:09 Xrayez

Seems like GDScript bug in 3.2 according to godotengine/godot#41319.

See also https://github.com/goostengine/goost/commit/4acf00aea65b6860649b6defe1008cf2abf589b6.

Xrayez avatar Sep 17 '20 12:09 Xrayez