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

No error on wrong MXML value type #96

Closed
Harbs opened this issue Sep 24, 2019 · 2 comments
Closed

No error on wrong MXML value type #96

Harbs opened this issue Sep 24, 2019 · 2 comments
Assignees
Labels

Comments

@Harbs
Copy link
Contributor

Harbs commented Sep 24, 2019

Specifying a simple value for MXML which requires a complex value should cause a compile time error. One case which was just reported (https://stackoverflow.com/questions/58068839/how-to-use-graphic-svg-elements-with-apache-royale) is where an int was specified instead of an IFill for a Rect.

That causes the compiled MXML to have an empty array which cannot be resolved to a class at runtime. The runtime error is very opaque to users. A much better user experience would be an error "Expected IFill, but got int instead" with a pointer to the correct location in the MXML.

@joshtynjala
Copy link
Member

Here is some Royale code that should result in a compiler error, but does not:

<js:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:js="library://ns.apache.org/royale/basic" xmlns:svg="library://ns.apache.org/royale/svg">
	<js:initialView>
		<js:View>
			<svg:Rect height="50" width="50" fill="0xff0000"/>
		</js:View>
	</js:initialView>
</js:Application>

A similar app created with Flex might look like this:

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
	xmlns:s="library://ns.adobe.com/flex/spark">
	<s:Rect height="50" width="50" fill="0xff0000"/>
</s:Application>

Attempting to compile this code with the Flex SDK produces the following compiler error:

Error: Initializer for 'fill': values of type mx.graphics.IFill cannot be represented in text.

@joshtynjala joshtynjala self-assigned this Nov 26, 2019
@joshtynjala
Copy link
Member

Closed in dc3b2cd

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