Community
Participate
Working Groups
The 2 variations is successful in 0.7 but fail in 0.8I1 lang.expression.initializer.ObjectInitialization001 function recordToAnyAssignment01() {@Test} firstRec myLittleRecord; any1 any = firstRec; any2 any = any1; any1.thing2 = "modified.two"; expected string = "two"; LogResult.assertStringEqual1(expected, firstRec.thing2); end lang.expression.parameter.NumberParameter003 /* NumberParameters003::testFunctionParameterInOutWithUpdate: ERROR - uncaught exception for: NumberParameters003::testFunctionParameterInOutWithUpdate => CRRUI2017E: [CRRUI2017E] The value "eglx.lang.anyboxedobject" of type eglx.lang.anyboxedobject cannot be converted to type smallint NumberParameters003::testFunctionParameterOutWithUpdate: ERROR - uncaught exception for: NumberParameters003::testFunctionParameterOutWithUpdate => CRRUI2017E: [CRRUI2017E] The value "eglx.lang.anyboxedobject" of type eglx.lang.anyboxedobject cannot be converted to type smallint */ function testFunctionParameterInOutWithUpdate() {@Test} localAny any = 3; updateInOutParameter(localAny); LogResult.assertTrue1((localAny as smallInt) == updated); end function testFunctionParameterOutWithUpdate() {@Test} localAny any = 3; updateOutParameter(localAny); LogResult.assertTrue1((localAny as smallInt) == updated); // LogResult.failed("Java COMPILE value-to-reference"); end
Created attachment 209674 [details] Patch to resolve the defect This problem is caused by IR change. The RHS of assignment to an any type is changed from BoxedExpression to AsExpression. The attached fix can resolve this problem but when testing EUnit, it causes some failure in JSONLib. I will investigate later.
I have put a temporary change in IRUtils to fix this problem. The difference in the IRs that is causing the problem for JS gen is that the boxing expression was being wrappered in an AS expression. In .7, we only created a boxing expression when making any type compatible with ANY. The change I made was to skip creating the AS expression, if the type being converted to is ANY. NOTE: There is still a problem in JS generation. If I code the following: firstRec myLittleRecord; //any record definition will do any1 any?; any1 = firstRec; any1 = firstrec as any; The first assignment statement will now (after my fix) result in the record being cloned before assinging to the any1. However, the second assignment does NOT do a clone. JSGen needs to be changed to tolerate the AS expression. Once JSGen is fixed, we can remove the change I made to IRUtils for I1.
After Paul's change, one small change was needed in the runtime. In edt_runtime.js I made EAny.fromEAny know how to convert an AnyBoxedObject into an Any. I'm changing the target of this bug from I1 to I2 because the regressions are now fixed, but the problem described by Paul needs to be fixed too.
Created attachment 211164 [details] patch for comment 2 Hi Paul, Please continue your change described in comment 2. Thanks.
Created attachment 211364 [details] EUnit test results
I ran the failing variations with the current EDT 0.8 I2 build and EDT 0.7. The results are exactly the same! They're in the attached zip file if you want to see them. In 0.7 and 0.8 I2, the variation lang.expression.initializer.ObjectInitialization001.recordToAnyAssignment01 does not fail. But there are many failures in both 0.7 and 0.8 I2 when you run lang.expression.parameter.NumberParameter003. All of those failures happen when an Any variable is passed to a function whose parameter is a Number. Paul and Ji Yong, please discuss what changes need to be made.
(In reply to comment #6) > I ran the failing variations with the current EDT 0.8 I2 build and EDT 0.7. > The results are exactly the same! They're in the attached zip file if you want > to see them. > > In 0.7 and 0.8 I2, the variation > lang.expression.initializer.ObjectInitialization001.recordToAnyAssignment01 > does not fail. But there are many failures in both 0.7 and 0.8 I2 when you run > lang.expression.parameter.NumberParameter003. All of those failures happen > when an Any variable is passed to a function whose parameter is a Number. > > Paul and Ji Yong, please discuss what changes need to be made. Matt, Yes, the regression are resolved now. But in comment 2, Paul states "we can remove the change I made to IRUtils for I1." So I transfer this bug to Paul for additional work. While the failure in lang.expression.parameter.NumberParameter003, it is not regression. I wonder if we should open another bug for it. We have a lot of failures in EUnit. In the past, only regressions are opened as bugs.
Are you saying that I should remove the "patch" I put in for I1? Does JSGen now generate a clone when using an explicit AS expression on the assingment?
(In reply to comment #8) > Are you saying that I should remove the "patch" I put in for I1? Does JSGen now > generate a clone when using an explicit AS expression on the assingment? Yes. Clone is generated for As expression of record. Please go ahead to remove the "patch".
I have removed the patch that was put in for I1.
Verified in build 0.8.0.v201202282102-1Co-FjuJ6QMNSP5RWtPdGC8G