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

Cast operator precedence is incorrect

    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

            paulk Paul King
            melix C├ędric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: