Created
December 3, 2014 10:29
-
-
Save paulk-asert/302a3fd361dba9bf0861 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.codehaus.groovy.ast.expr.* | |
incompatibleAssignment { lhsType, rhsType, expr -> | |
if (!(expr instanceof DeclarationExpression)) return | |
Expression orig = expr.rightExpression | |
def ce = new CastExpression(lhsType, orig) | |
ce.coerce = true | |
expr.setRightExpression(ce) | |
storeType(expr, lhsType) | |
handled = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a version supporting list literals on LHS (very basic test) :