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

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

Open
Xrayez opened this issue Sep 17, 2020 · 1 comment
Open
Labels
bug Something isn't working topic:core Waiting for Godot ⏳ The engine needs a fix or an enhancement to fix the issue workaround available 🔨

Comments

@Xrayez
Copy link
Contributor

Xrayez commented Sep 17, 2020

Goost and Godot version:
gd3 @ 455ebc0, 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:

func test_list_inside_list_node__via_manual_value_set():
var nodes = populate_test_data(list)
assert_not_null(list.find("Goost"))
var new_list = LinkedList.new()
var new_node = new_list.push_back("Godot")
assert_eq(new_node.value, "Godot")
assert_not_null(list.front)
# This works.
var n = list.front
n.value = new_list
# FIXME: the following doesn't work, throws an error:
# 'Invalid set index 'front' (on base: 'LinkedList') with value of type 'ListNode'.'
# Despite the fact that `new_list` is NOT a `ListNode`,
# and the referenced `front` property is incorrect (the above works).
#
# list.front.value = new_list
assert_eq(list.front.value.front.value, "Godot")

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
Copy link
Contributor Author

Xrayez commented Sep 17, 2020

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

See also 4acf00a.

@Xrayez Xrayez added the Waiting for Godot ⏳ The engine needs a fix or an enhancement to fix the issue label Sep 23, 2020
@Xrayez Xrayez changed the title Attempting to assign any value to LinkedList.front directly results in an error Assigning any value to LinkedList.front directly results in an error Oct 3, 2020
@Xrayez Xrayez added this to the gd3 milestone Apr 12, 2021
@Xrayez Xrayez modified the milestones: 1.0-gd3, 1.1-gd3 Jul 22, 2021
@Xrayez Xrayez removed this from the 1.1-gd3 milestone Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic:core Waiting for Godot ⏳ The engine needs a fix or an enhancement to fix the issue workaround available 🔨
Projects
None yet
Development

No branches or pull requests

1 participant