feathersui / feathersui-starling

User interface components for Starling Framework and Adobe AIR
https://feathersui.com/learn/as3-starling/
Other
915 stars 386 forks source link

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

Open kevinfoley opened 6 years ago

kevinfoley commented 6 years ago

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?

joshtynjala commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

joshtynjala commented 6 years ago

Try this compiler option:

-warn-unlikely-function-value=false