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

Compiler warning for ButtonGroup "triggered" field (MXML) #1681

Open
kevinfoley opened this issue Jan 30, 2018 · 4 comments
Open

Compiler warning for ButtonGroup "triggered" field (MXML) #1681

kevinfoley opened this issue Jan 30, 2018 · 4 comments
Labels

Comments

@kevinfoley
Copy link
Contributor

kevinfoley commented Jan 30, 2018

I have some code like this:

<f:ButtonGroup id="buttonGroup" styleName="{Alert.DEFAULT_CHILD_STYLE_NAME_BUTTON_GROUP}">
	<f:dataProvider>
		<f:ArrayCollection>
			<!--These lines trigger compiler warnings -->
			<fx:Object label="Ok" triggered="{save}" />
			<fx:Object label="Cancel" triggered="{close}" />
		</f:ArrayCollection>
	</f:dataProvider>

This code works as desired, but triggers a compiler warning: Warning: Function value used where type * was expected. Possibly the parentheses () are missing after this function reference. for the {save} and {close} parts.

Is there a better syntax to use, or a metadata tag to tell the compiler to ignore the warning?

@kevinfoley kevinfoley changed the title Compiler warning for ButtonGroup "triggered" field Compiler warning for ButtonGroup "triggered" field (MXML) Jan 30, 2018
@joshtynjala
Copy link
Member

The compiler is just trying to be helpful, since you might have meant to call the function. You can ignore this warning, since you're doing exactly what you mean to.

I could probably come up with some ideas for different syntax that would get rid of the warning, but I'm not sure I'd call it "better".

For instance, this might get rid of the warning because it's declared as a variable (or it might not... it's just an idea off the top of my head):

private var saveCallback:Function = save;

You may need to give this variable [Bindable] metadata to avoid a completely different warning, though.

@kevinfoley
Copy link
Contributor Author

My IDE (FlashDevelop) halts the compile when it detects this warning, and I have to click "Build" a second time to get past the warning. I'd rather not disable warnings altogether, so that's why I'm looking for an alternative syntax or a way to disable that specific warning. I recall that IntelliJ supports meta tags to ignore compiler warnings, but I think these were IDE-specific rather than something build into the AS compiler.

Would it be possible for you to add a metadata tag to the Feathers SDK compiler for ignoring this type of error?

@kevinfoley
Copy link
Contributor Author

The best solution I could find was to remove the MXML and do the equivalent thing in AS3.

@joshtynjala
Copy link
Member

Try this compiler option:

-warn-unlikely-function-value=false

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

No branches or pull requests

2 participants