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

Ternary with object literal #330

Closed
Gama11 opened this issue Feb 6, 2019 · 0 comments
Closed

Ternary with object literal #330

Gama11 opened this issue Feb 6, 2019 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@Gama11
Copy link
Member

Gama11 commented Feb 6, 2019

Describe the bug

I guess the formatter thinks that's an empty block rather than an object literal.

Input file

class Main {
	public static function main() {
		return (meta == null || meta.obj == null) ? {} : meta.obj;
	}
}

Broken output

class Main {
	public static function main() {
		return (meta == null || meta.obj == null) ? {}
			: meta.obj;
	}
}
@Gama11 Gama11 added the bug Something isn't working label Feb 6, 2019
@Gama11 Gama11 added this to the haxe milestone Feb 6, 2019
AlexHaxe added a commit to AlexHaxe/haxe-formatter that referenced this issue Feb 15, 2019
fixed ternary with object literal, fixes HaxeCheckstyle#330
fixes optional function parameters in conditionals, fixes HaxeCheckstyle#345
fixes ternary with opbool, fixes HaxeCheckstyle#348
fixes unary after conditional, fixes HaxeCheckstyle#348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant