conjure-cp / conjure

Conjure: The Automated Constraint Modelling Tool
Other
96 stars 20 forks source link

Bad error messages #521

Closed ozgurakgun closed 1 year ago

ozgurakgun commented 2 years ago

These are found by @fionakillalea - thanks!

Two areas that resulted in the "This should never happen, sorry!" errors in the program.

The first occurs with the flatten function when the arguments to the function are in the wrong order (the int should be the first argument) as demonstrated in an example below.

find b : bool such that b = ([1, 2, 3] = flatten([1, 2, 3], 0))

The second bug I found occurs with the alldifferent_except function when the second operator is missing, as shown below.

find c : bool such that c = alldifferent_except([1, 2, 5, 1, 6])

fionakillalea commented 2 years ago

There is also this bug when the second argument (which is meant to be a partition) is missing for the operator party. For example, in the following Essence:

find b : set of int(1..6) such that b = party(5)

ozgurakgun commented 1 year ago

I've just reproduced this. @Maurice-Byrne can you check what your new parser does on these examples please? There are 3 test cases in the above commit: https://github.com/conjure-cp/conjure/commit/23ef5ec7ecac8b6a0ae42dffe28e1fb96a7b14c4

Ye olde parser get's very angry.

1.essence

conjure: This should never happen, sorry!

However, it did happen, so it must be a bug. Please report it to us!

Conjure is actively maintained, we will get back to you as soon as possible.
You can help us by providing a minimal failing example.

Also include the repository version for this build: a7382e3d9 (2022-11-21 10:41:03 +0000)

Issue tracker: http://github.com/conjure-cp/conjure/issues

The 1st argument of flatten has to be a constant integer.

CallStack (from HasCallStack):
  error, called at src/Conjure/Bug.hs:21:15 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Bug
  bug, called at src/Conjure/Language/Expression/Op.hs:140:61 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Language.Expression.Op

2.essence

conjure: This should never happen, sorry!

However, it did happen, so it must be a bug. Please report it to us!

Conjure is actively maintained, we will get back to you as soon as possible.
You can help us by providing a minimal failing example.

Also include the repository version for this build: a7382e3d9 (2022-11-21 10:41:03 +0000)

Issue tracker: http://github.com/conjure-cp/conjure/issues

Missing argument 2 for operator allDiffExcept

CallStack (from HasCallStack):
  error, called at src/Conjure/Bug.hs:21:15 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Bug
  bug, called at src/Conjure/Language/Expression/Op.hs:148:20 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Language.Expression.Op

3.essence

conjure: This should never happen, sorry!

However, it did happen, so it must be a bug. Please report it to us!

Conjure is actively maintained, we will get back to you as soon as possible.
You can help us by providing a minimal failing example.

Also include the repository version for this build: a7382e3d9 (2022-11-21 10:41:03 +0000)

Issue tracker: http://github.com/conjure-cp/conjure/issues

Missing argument 2 for operator party

CallStack (from HasCallStack):
  error, called at src/Conjure/Bug.hs:21:15 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Bug
  bug, called at src/Conjure/Language/Expression/Op.hs:148:20 in conjure-cp-2.4.0-Ix4U3uN6RJ2JFXQO53asWL:Conjure.Language.Expression.Op