New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad code generation from certain constraints #1164

Closed
TimLethbridge opened this Issue Nov 24, 2017 · 1 comment

Comments

@TimLethbridge
Member

TimLethbridge commented Nov 24, 2017

The following code generates two separate errors regarding the [i >= 0]

For the first case the wrong variable is accessed; for the second case, only one of the constraints is checked.

See also issue #89 which is the general issue.

class A {
  Integer i = 0;
  // the generated code for the constraint does not compile
  [i >= 0]
}

class B {
  Integer i;
  // code is not generated in the constructor for i's constraint
  [i >= 0]
  Integer j;
  // it would also be great if an error message could be defined
  // (e.g., [j >= 0; "j cannot be negative!"]
  [j >= 0]
}
@TimLethbridge

This comment has been minimized.

Show comment
Hide comment
@TimLethbridge

TimLethbridge Feb 9, 2018

Member

We have discovered that errors 28 and 29 are not being raised and the tests are commented out

I discovered that the detecting of missing errors occurred between
releases 20.1 May 16, 2014
and 20.2 August 5, 2014 ! So way back.

The commit to blame is here:

4f6b0ca#diff-4eecc29d70a261eb76d9a240e24208ff

The test for error 28 is still there but it has an @ignore on it! Added by
that commit

test/cruise/umple/compiler/ParserConstraintExpressionsTest.java:17

which also replaced a whole chunk of code in
UmpleInternalParser_CodeConstraints.ump

that was supposed to be doing the analysis.

Member

TimLethbridge commented Feb 9, 2018

We have discovered that errors 28 and 29 are not being raised and the tests are commented out

I discovered that the detecting of missing errors occurred between
releases 20.1 May 16, 2014
and 20.2 August 5, 2014 ! So way back.

The commit to blame is here:

4f6b0ca#diff-4eecc29d70a261eb76d9a240e24208ff

The test for error 28 is still there but it has an @ignore on it! Added by
that commit

test/cruise/umple/compiler/ParserConstraintExpressionsTest.java:17

which also replaced a whole chunk of code in
UmpleInternalParser_CodeConstraints.ump

that was supposed to be doing the analysis.

TimLethbridge added a commit that referenced this issue Apr 17, 2018

Merge pull request #1259 from umple/MultipleConstraints_1164
Progress on #1164 Added check for error 28

TimLethbridge added a commit that referenced this issue Apr 23, 2018

Merge pull request #1261 from umple/MultipleConstraints_1164
Fixes #1164 Added checking for error 29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment