Skip to content

[ENHANCEMENT] Allow interfaces to be parsed and no longer throw errors when they exist in scripts.#284

Merged
EliteMasterEric merged 1 commit intoFunkinCrew:experimentalfrom
Starexify:allow-interfaces
Feb 4, 2026
Merged

[ENHANCEMENT] Allow interfaces to be parsed and no longer throw errors when they exist in scripts.#284
EliteMasterEric merged 1 commit intoFunkinCrew:experimentalfrom
Starexify:allow-interfaces

Conversation

@Starexify
Copy link

@Starexify Starexify commented Jan 18, 2026

This PR allows interfaces to be parsed and not just throw errors, which would make the whole script no longer work, even when working classes are inside.

For now this is just allowing people to add interfaces without getting errors if they have them in their code structure alongside classes/enums etc.

Now

image

Before this would be shown

image

Since hscriptpolymod would return unexpected(TId(ident));

@EliteMasterEric EliteMasterEric self-requested a review January 19, 2026 22:56
@Starexify Starexify force-pushed the allow-interfaces branch 2 times, most recently from 74e5c05 to 927ab60 Compare January 26, 2026 15:59
@Starexify
Copy link
Author

Copy paste from the hscript PR:
Also I tried in tryhaxe this snippet which shows how externs behave, private, static, final works, but not override/inline. So that's why I didnt allow the inline keyword if someone is wondering

class Test {
	static function main() {
		var test = new TestClass();
		trace(TestClass.id);
		trace(test.nr);
		trace(test.test());
	}
}

class TestClass implements TestInterface {
	var name:String = "class";

	public static final id:Int = 1;

	public var nr:Int = 90;

	public function new() {}

	public function test():String {
		return "TEST";
	}
}

extern interface TestInterface extends TestInterfaceTwo {
	private var name:String;
	static final id:Int;
	var nr:Int;
}

interface TestInterfaceTwo {
	function test():String;
}

@Starexify Starexify force-pushed the allow-interfaces branch 2 times, most recently from a59254e to 68b97e1 Compare February 1, 2026 09:43
@EliteMasterEric
Copy link
Member

To clarify, this does not mandate that the scripted class implements the interface, right? It just parses the interface and stores the data for later?

@Starexify
Copy link
Author

Starexify commented Feb 4, 2026

To clarify, this does not mandate that the scripted class implements the interface, right? It just parses the interface and stores the data for later?

Yes, this only parses the interfaces, nothing else. It doesnt handle any of the interface logic.
But they could be implement by classes before this PR if they were in separate files. This just makes them not throw errors and breaking the script file if theyre in the same file as actual script classes, and allows parsing if they are ever gonna be needed in the future.

@EliteMasterEric
Copy link
Member

Tested with the repro script and it does fix the issue, thanks for your hard work

@EliteMasterEric EliteMasterEric merged commit 1069831 into FunkinCrew:experimental Feb 4, 2026
@Starexify Starexify deleted the allow-interfaces branch February 4, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants