Skip to content

'export var' infers the wrong type of preload() #61752

@lapspider45

Description

@lapspider45

Godot version

v3.5.rc3.official.af8a02dda

System information

Linux

Issue description

export var example := preload("ExampleNode.tscn") results in this error message:

 built-in:3 - Parse Error: The export hint's type (Object) doesn't match the variable's type (PackedScene).
 modules/gdscript/gdscript.cpp:597 - Method failed. Returning: ERR_PARSE_ERROR

I'm getting the same parser error on 3.5 rc2 and 3.4.4 stable. Haven't tested other versions.

Steps to reproduce

extends Node

export var example := preload("ExampleNode.tscn") # parse error

export var example2 : PackedScene = preload("ExampleNode.tscn") # no error
var example3 := preload("ExampleNode.tscn") # no error

Minimal reproduction project

MRP_export_PackedScene.zip
(same code as in the steps to reproduce)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions