apache / apache/royale-asjs

Extra `as` coercion

Open
#642 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
ActionScript
Stars
380
Forks
120
PR merge metrics
No merged PRs in 30d

Description

In `Language` there is an `as` coercion which should not be added since there's an ignore directive before the function:
https://github.com/apache/royale-asjs/blob/27c290af0bd817f61ab509c32944bd6b8e84bc69/frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as#L602

It's compiling like so:
````
if (source && Array.isArray(source)) {
var /** @type {Array} */ arr = org.apache.royale.utils.Language.as(source, Array);
return org.apache.royale.utils.Language.VectorSupport.checkIsVector(arr, typeName) ? arr : org.apache.royale.utils.Language.VectorSupport.arrayVector(arr.slice(), (arr.length) >> 0, elementType, false, null, false);
}
````
I think the reason we're getting the coercion is because it's nested in an inner function.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in frameworks/projects/Language/src/main/royale/org/apache/royale/utils/Language.as around line 602 and inspect how the ignore directive interacts with the nested function. Compare the generated output with the example in the issue; done means the unwanted Language.as coercion is no longer emitted for this case.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.