-
Notifications
You must be signed in to change notification settings - Fork 18
Assigning any value to LinkedList.front directly results in an error #17
Copy link
Copy link
Open
Labels
Waiting for Godot ⏳The engine needs a fix or an enhancement to fix the issueThe engine needs a fix or an enhancement to fix the issuebugSomething isn't workingSomething isn't workingtopic:coreworkaround available 🔨
Description
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
ListNodein 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:
goost/tests/project/goost/core/types/test_list.gd
Lines 597 to 616 in 455ebc0
| 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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Waiting for Godot ⏳The engine needs a fix or an enhancement to fix the issueThe engine needs a fix or an enhancement to fix the issuebugSomething isn't workingSomething isn't workingtopic:coreworkaround available 🔨