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

GDScript 2.0: Inner class type declarations mismatched in outer scope #47062

Closed
lyuma opened this issue Mar 16, 2021 · 1 comment
Closed

GDScript 2.0: Inner class type declarations mismatched in outer scope #47062

lyuma opened this issue Mar 16, 2021 · 1 comment
Assignees
Milestone

Comments

@lyuma
Copy link
Contributor

lyuma commented Mar 16, 2021

Godot version:
4.0.dev 8e293ba

OS/device including version:
Windows 10.0.19041.804

Issue description:
I declared an inner class, which has a function returning a value of its own type or a supertype (sibling types are for some reason not in scope. Maybe related?)

Then, I declared a function in the containing .gd file which returns a value of the inner type. However, the two types are not compatible.

Script:

extends Reference
class InnerClass extends Reference:
	static func some_static_func() -> InnerClass:
		return new()

func create_inner_instance1() -> InnerClass:
	return InnerClass.some_static_func()

Error:

Cannot return value of type "GDScript" because the function return type is "InnerClass"

Steps to reproduce:

  1. Open the example project.
  2. Try to enable the "inner_class_decl" plugin.
  3. It will give the above error at inner_classes.gd

Minimal reproduction project:
ImportedTypeDecl.zip

@Calinou Calinou added this to the 4.0 milestone Mar 16, 2021
@Calinou Calinou changed the title GDScript: Inner class type declarations mismatched in outer scope GDScript 2.0: Inner class type declarations mismatched in outer scope Mar 16, 2021
@vnen
Copy link
Member

vnen commented Oct 15, 2021

I think this is the same as #47063, which was fixed by #49105. At least I can't reproduce with the snippet in the post (the project is outdated given some renames and have some actual errors, so it's a bit difficult to test). I'll assume this is solve, as the mentioned error doesn't happen anymore.

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

3 participants