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

[3.5 beta3] GDScript release builds can't infer type of builtin function return values #59723

Closed
ghost opened this issue Mar 31, 2022 · 5 comments

Comments

@ghost
Copy link

ghost commented Mar 31, 2022

Godot version

3.5 beta3

System information

Linux, GLES 3, Intel Graphic UHD 630

Issue description

Game crashes when below gdscript is compiled in release mode (in debug mode it can run normally)

extends Node

const MIN_TIME = 800
var start_time: int

func _ready():
	start_time = OS.get_ticks_msec()

func _process(_delta):
	var spent_time := OS.get_ticks_msec() - start_time
	var sleep_time = (MIN_TIME - spent_time) as float / 1000.0

with error message:

SCRIPT ERROR: Parse Error: The assigned value doesn't have a set type; the variable type can't be inferred.
          at: GDScript::load_byte_code (res://Main/test.gdc:11)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: load_byte_code (modules/gdscript/gdscript.cpp:782)
ERROR: Cannot load byte code from file 'res://Main/test.gdc'.
   at: load (modules/gdscript/gdscript.cpp:2205)
ERROR: Failed loading resource: res://Main/test.gdc. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: res://Main/Main.tscn:4 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Main/test.gd
   at: poll (scene/resources/resource_format_text.cpp:412)
ERROR: Failed to load resource 'res://Main/Main.tscn'.
   at: load (core/io/resource_loader.cpp:206)
ERROR: Failed loading resource: res://Main/Main.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: _load (core/io/resource_loader.cpp:270)
ERROR: Failed loading scene: res://Main/Main.tscn
   at: start (main/main.cpp:2083)
WARNING: ObjectDB instances leaked at exit (run with --verbose for details).
     at: cleanup (core/object.cpp:2064)

Steps to reproduce

download the Minimal reproduction project, export game in release mode and run the game

Minimal reproduction project

test.zip

@ghost
Copy link
Author

ghost commented Mar 31, 2022

maybe related to #59716

@Listwon
Copy link
Contributor

Listwon commented Mar 31, 2022

Godot 3.5 beta3, the same issue reproducible with different MRP.
Release build has problem with type inference in line var err := file.open("user://save_game.dat", File.READ)

I noticed it with different method calls too. Like trying to infer the Array type returned from intersect_point.

type_inference_mrp.zip

@akien-mga
Copy link
Member

I assume this might also be reproducible in 3.5 beta 2, but not in beta 1?
This is likely a regression from #57851.

@akien-mga akien-mga changed the title [3.5 beta3] Game crashes in release mode with specific GDScript [3.5 beta3] GDScript release builds can't infer type of builtin function return values Mar 31, 2022
@ghost
Copy link
Author

ghost commented Mar 31, 2022

Can confirm that 3.5 beta 1 does not have this problem.

@akien-mga
Copy link
Member

Fixed by #59793.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants