Skip to content

Instantly share code, notes, and snippets.

@paulk-asert
Created December 3, 2014 10:29
Show Gist options
  • Save paulk-asert/302a3fd361dba9bf0861 to your computer and use it in GitHub Desktop.
Save paulk-asert/302a3fd361dba9bf0861 to your computer and use it in GitHub Desktop.
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
}
@paulk-asert
Copy link
Author

cool, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment