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

Int can be re-assigned when returned from extern inline function #8517

Closed
Aurel300 opened this issue Jul 5, 2019 · 1 comment · Fixed by #8518
Closed

Int can be re-assigned when returned from extern inline function #8517

Aurel300 opened this issue Jul 5, 2019 · 1 comment · Fixed by #8518
Labels
Milestone

Comments

@Aurel300
Copy link
Member

Aurel300 commented Jul 5, 2019

extern class Foobar {
	static var a:Int;
	static inline function foo():Int return a;
}
class Test {
	public static function main():Void {
		Foobar.foo() = 2;
	}
}

This should fail to compile with Test.hx:7: characters 3-15 : Invalid assign, but it does not. This could cause a runtime exception instead, e.g. on Python:

var a = Date.now();
a.getFullYear() = 3;

(Throws AttributeError: attribute 'year' of 'datetime.date' objects is not writable.)

@Aurel300 Aurel300 added the bug label Jul 5, 2019
@nadako
Copy link
Member

nadako commented Jul 5, 2019

Ouch. That's actually pretty bad, because my converter can currently generate code like a.getFullYear() = 3 in some cases, and my plan is/was to catch these cases by looking at Haxe compile errors :)

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

Successfully merging a pull request may close this issue.

3 participants