Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5185

Cast operator precedence is incorrect

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

      Description

      The cast operator precedence is incorrect:

      def i = (int)1/(int)2
      assert i.class==BigDecimal // fails
      

      To have proper casts, we need extra parenthesis which should not be necessary:

      def i = ((int)1)/((int)2)
      assert i.class==BigDecimal // ok
      

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              melix C├ędric Champeau

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment