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

try-catch vs @:to #8257

Closed
nadako opened this issue May 7, 2019 · 4 comments
Closed

try-catch vs @:to #8257

nadako opened this issue May 7, 2019 · 4 comments

Comments

@nadako
Copy link
Member

nadako commented May 7, 2019

abstract Dyn(Dynamic) from Dynamic {
	@:to function toDynamic():Dynamic return this;
}

class Main {
	static function main() {
		var value:Dyn = "s";
		(try value catch (pokemon:Dynamic) null : String);
	}
}

will fail with Main.hx:8: characters 8-13 : Dyn should be String

@nadako
Copy link
Member Author

nadako commented May 7, 2019

This is specific to try/catch because (if (Math.random() < 0.5) value else null : String) compiles!

@Aurel300
Copy link
Member

Aurel300 commented May 7, 2019

Interestingly enough the above code compiles in 3.4.4.

@nadako
Copy link
Member Author

nadako commented May 7, 2019

try-haxe says it also compiles in 4.0.0-preview.1, so this is a 4.0 regression

@Gama11 Gama11 added this to the Release 4.0 milestone May 7, 2019
@Simn Simn closed this as completed in 478c8f4 May 7, 2019
@nadako
Copy link
Member Author

nadako commented May 7, 2019

Thanks a lot, that was quick!

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