Coercion inconsistency when using compound assignment operators (+=, -=, etc...) Uncaught translation error

(Luke Bartolomeo) #1

Applies to Silver (Elements 10) running on Android. Not sure if it would apply to other targets.


		var val1: Float = 3.1
		var val2: Double = 6.9

The following works:

		val1 = val1 + val2 // 10.0

val2 is implicitly cast to a Float.
But when a compound assignment operator is used:

		val1 += val2 // Uncaught translation error expected type double but found float

But explicitly casting val2 to a Float does work.

		val1 += Float(val2) 

I really don’t care about having to specify the cast myself, but Elements should catch the error earlier in the build process. Uncaught translation errors are very challenging to debug. In my case, I was upgrading a project created in Fire/Elements 9.1 to Fire/Elements 10. It was very tedious to track down in a large project where the uncaught translation error was coming from.
Hopefully this saves someone else some time. Now I can get back to work!

(RemObjects) #2

Thanks, logged as bugs://79557

(Carlo Kok) #3

Agreed. That shouldn’t happen.

(RemObjects) #4

bugs://79557 got closed with status fixed.