Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

*= and /= appear to confuse DDC #11

Closed
jacob314 opened this issue Dec 23, 2014 · 2 comments
Closed

*= and /= appear to confuse DDC #11

jacob314 opened this issue Dec 23, 2014 · 2 comments

Comments

@jacob314
Copy link
Contributor

Repro steps from number_format.dart in intl

 /** Format the number in exponential notation. */
  void _formatExponential(num number) {
    if (number == 0.0) {
      _formatFixed(number);
      _formatExponent(0);
      return;
    }

    var exponent = (log(number) / log(10)).floor();
    var mantissa = number / pow(10.0, exponent);

    var minIntDigits = minimumIntegerDigits;
    if (maximumIntegerDigits > 1 && maximumIntegerDigits > minimumIntegerDigits)
        {
      // A repeating range is defined; adjust to it as follows.
      // If repeat == 3, we have 6,5,4=>3; 3,2,1=>0; 0,-1,-2=>-3;
      // -3,-4,-5=>-6, etc. This takes into account that the
      // exponent we have here is off by one from what we expect;
      // it is for the format 0.MMMMMx10^n.
      while ((exponent % maximumIntegerDigits) != 0) {
        mantissa *=  /* severe: StaticTypeError */ 10;
        exponent--;
      }
      minIntDigits = 1;
    } else {
      // No repeating range is defined, use minimum integer digits.
      if (minimumIntegerDigits < 1) {
        exponent++;
        mantissa /=  /* severe: StaticTypeError */ 10;
      } else {
        exponent -= minimumIntegerDigits - 1;
        mantissa *= pow(10, minimumIntegerDigits - 1);
      }
    }
    _formatFixed(mantissa);
    _formatExponent(exponent);
  }
@sigmundch
Copy link
Contributor

This seems to be a bug in how DDC treats operator-equals assignments. Here is an isolated test case:

          class A {
            A operator *(B b) {}
          }
          class B {}
          test() {
            A a = new A();
            B b = new B();
            a = a * b;
            a *= b;
          }

This produces an error on a *= b; saying that type B cannot be assigned to type A.

@vsmenon vsmenon self-assigned this Jan 6, 2015
@vsmenon
Copy link
Contributor

vsmenon commented Jan 8, 2015

Should be fixed now, but there are related issues here:
#18

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants