Advertisement

Error for non-default namespace interfaces used in methods of mixin classes inherited from by classes in another namespaces

Started by January 21, 2015 09:06 PM
1 comment, last by WitchLord 9 years, 10 months ago

I just couldn't help but make the title comprehensive.

Here's an example piece of code that, tested in AngelScript 2.29.2, causes a compilation error that shouldn't happen:


namespace n {
	interface i {}
	mixin class m {
		void f(i@) {}
	}
}
class c : n::m {}

The error reads:

ERR : Identifier 'i' is not a data type in global namespace

...which is irrefutably true, but hardly justifying. Handles to the interface can be used correctly as members of the mixin class but an attempt to use them as method arguments or other local variables in methods will make the compiler try to use types defined in the global namespace (or whatever the namespace of the class named "c" in the example is). It goes without saying that this may have bad consequences if, for example, both the local and global namespaces contain an interface named "i" and the mixin class is registered as:


mixin class m {
	i@ foo;
	void f(i@ bar) {
		@foo = @bar;
	}
}

Such code will generate a rather hilarious error:

ERR : Can't implicitly convert from 'i@&' to 'i@'.

Thanks for the report.

I'll investigate it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this in revision 2116.

Thanks,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement