feathersui-starling icon indicating copy to clipboard operation
feathersui-starling copied to clipboard

Compiler warning for ButtonGroup "triggered" field (MXML)

Open kevinfoley opened this issue 6 years ago • 4 comments

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 avatar Jan 30 '18 20:01 kevinfoley

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.

joshtynjala avatar Jan 30 '18 20:01 joshtynjala

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 avatar Feb 02 '18 00:02 kevinfoley

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

kevinfoley avatar Feb 02 '18 00:02 kevinfoley

Try this compiler option:

-warn-unlikely-function-value=false

joshtynjala avatar Feb 02 '18 22:02 joshtynjala