error on static typing and custom classes

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Insanee

Hi, i have a problem, i’m making a position list that uses linked nodes, the thing is that if define the static type of a parameter with the same type of the class that is implementing the function gdScript will take it as cyclic reference

extends Node
class_name NodoPL 
var element
var nodo_previo
var nodo_siguiente

func _init(e, prev: NodoPL, next: NodoPL):
   element = e
   nodo_previo = prev
   nodo_siguiente = next

this wont cause any error but the class that preloads NodoPL will say

couldn’t fully preload the script, posible cyclic reference or compliation error. use load() if a cyclic reference is intended

if i use load is still have the error but when i use the class for static typing

:bust_in_silhouette: Reply From: klaas

Hi,
this is perfectly fine when i test it.

Godot has some sort of class caching and makes some weired things when changing class names and alike. Saving reloading or rewriting(copy paste) the scripts mostly fixes this issues.
Dont know exactly what causes those flaws.

so i should ignore the error?

Insanee | 2020-09-03 14:17

well, you cant when its not compiling. But i have put your provided code into a project and its states no error.
Are you sure the error is located there?

klaas | 2020-09-03 15:01