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

parse error with typed gdscript #20346

Closed
volzhs opened this issue Jul 22, 2018 · 4 comments · Fixed by #20468
Closed

parse error with typed gdscript #20346

volzhs opened this issue Jul 22, 2018 · 4 comments · Fixed by #20468
Assignees
Milestone

Comments

@volzhs
Copy link
Contributor

volzhs commented Jul 22, 2018

Godot version:

3.1.dev 7478649

OS/device including version:

Kubuntu 18.04 / Android 8.0 (galaxy s8+)

Issue description:

str() causes parse error with exported game.

SCRIPT ERROR: GDScript::load_byte_code: Parse Error: Too many arguments for '()' call. Expected at most 0.                                                                                           
   At: res://Control.gdc:6.                                                                                                                                                                          
ERROR: load_byte_code: Method/Function Failed, returning: ERR_PARSE_ERROR                                                                                                                            
   At: modules/gdscript/gdscript.cpp:760.                                                                                                                                                            
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: modules/gdscript/gdscript.cpp:1939.
ERROR: _load: Failed loading resource: res://Control.gdc
   At: core/io/resource_loader.cpp:186.
ERROR: poll: res://Control.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Control.gd
   At: scene/resources/scene_format_text.cpp:439.
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: core/io/resource_loader.cpp:149.
ERROR: _load: Failed loading resource: res://Control.tscn
   At: core/io/resource_loader.cpp:186.
ERROR: start: Failed loading scene: res://Control.tscn
   At: main/main.cpp:1678.
WARNING: cleanup: ObjectDB Instances still exist!
   At: core/object.cpp:1990.
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:422.

I tested on Linux & Android.
Running in editor is fine.
I definitely compiled new x11, android templates with latest source code.

Steps to reproduce:

  1. type like this.
extends Control

func _ready():
	var n
	str(n)
  1. export it
  2. run exported game with Debug ON

Note that exported with release does not have this issue.

Minimal reproduction project:

Test typed gdscript.zip

@volzhs
Copy link
Contributor Author

volzhs commented Jul 22, 2018

cc @vnen

@akien-mga akien-mga added this to the 3.1 milestone Jul 22, 2018
@vnen vnen self-assigned this Jul 22, 2018
@jahd2602
Copy link
Contributor

Running a project on Android with Godot, 1 commit before #19264, works fine. After compiling master and testing on Android, I get a similar error:

07-24 11:47:34.419 15303-15337/org.godotengine.jumpingdown E/godot: **SCRIPT ERROR**: Parse Error: Too many arguments for '()' call. Expected at most 0 but called with 3.
       At: res://Scripts/jumpingPlayer.gdc:12:GDScript::load_byte_code() - Parse Error: Too many arguments for '()' call. Expected at most 0 but called with 3.
    **ERROR**: Method/Function Failed, returning: ERR_PARSE_ERROR
       At: modules\gdscript\gdscript.cpp:760:load_byte_code() - Method/Function Failed, returning: ERR_PARSE_ERROR
    **ERROR**: Condition ' err != OK ' is true. returned: RES()
       At: modules\gdscript\gdscript.cpp:1939:load() - Condition ' err != OK ' is true. returned: RES()
    **ERROR**: Failed loading resource: res://Scripts/jumpingPlayer.gdc
       At: core\io\resource_loader.cpp:186:_load() - Method/Function Failed, returning: RES()
    **ERROR**: res://Objects/jumping_down.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Scripts/jumpingPlayer.gd
       At: scene\resources\scene_format_text.cpp:439:poll() - res://Objects/jumping_down.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Scripts/jumpingPlayer.gd
    **ERROR**: Condition ' err != OK ' is true. returned: RES()
       At: core\io\resource_loader.cpp:149:load() - Condition ' err != OK ' is true. returned: RES()
07-24 11:47:34.427 15303-15337/org.godotengine.jumpingdown E/godot: **ERROR**: Failed loading resource: res://Objects/jumping_down.tscn
       At: core\io\resource_loader.cpp:186:_load() - Method/Function Failed, returning: RES()
07-24 11:47:34.442 15303-15337/org.godotengine.jumpingdown E/godot: **ERROR**: Failed loading scene: res://Objects/jumping_down.tscn
       At: main\main.cpp:1678:start() - Condition ' !scene ' is true. returned: false

BTW I changed gdscript_parser.cpp:6527 to get the arg_count

_set_error("Too many arguments for '" + callee_name + "()' call. Expected at most " + itos(arg_types.size()) + " but called with " + itos(arg_count) + ".", p_call->line); // Added arg_count to help debugging

BTW it is working fine in Windows and Linux. The error only happens in Android.

@Martinii89
Copy link

Martinii89 commented Jul 25, 2018

Similar problem also for windows export on version f8e8ac2.

Trying to export the multiplayer bomber demo project gives similar error messages for a debug export. Swapping all the str() calls with string interpolations did not solve the issue though. But might be related.

Minimal setup:

func _ready():
	#load gives critical errors in a export with debug
        #var world = load("res://world.tscn").instance()
	#with preload there is no issue in the export with debug
	var world = preload("res://world.tscn").instance()
	get_tree().get_root().call_deferred("add_child", world)

This script in the startup scene will cause a crash with the following error:

SCRIPT ERROR: GDScript::load_byte_code: Parse Error: Too many arguments for '()' call. Expected at most 0.
          At: res://Node2D.gdc:5
ERROR: load_byte_code: Method/Function Failed, returning: ERR_PARSE_ERROR
   At: modules/gdscript/gdscript.cpp:760
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: modules/gdscript/gdscript.cpp:1939
ERROR: Failed loading resource: res://Node2D.gdc
   At: core/io/resource_loader.cpp:186
ERROR: poll: res://main.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://Node2D.gd
   At: scene/resources/scene_format_text.cpp:439
ERROR: load: Condition ' err != OK ' is true. returned: RES()
   At: core/io/resource_loader.cpp:149
ERROR: Failed loading resource: res://main.tscn
   At: core/io/resource_loader.cpp:186
ERROR: Failed loading scene: res://main.tscn
   At: main/main.cpp:1678
WARNING: cleanup: ObjectDB Instances still exist!
     At: core/object.cpp:1990
ERROR: clear: Resources Still in use at Exit!
   At: core/resource.cpp:422

Also in this case, exporting with debug off seems to work fine.

@volzhs
Copy link
Contributor Author

volzhs commented Jul 25, 2018

@jahd2602 for me, exported apk with release works fine, but has above error with debug.

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

Successfully merging a pull request may close this issue.

5 participants