Skip to content

Commit

Permalink
reproducing #443
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgurakgun committed Sep 29, 2019
1 parent 7b8d238 commit dbb092b
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Conjure/Language/Constant.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ instance DomainSizeOf Constant Constant where

instance Pretty Constant where

pretty (TypedConstant (ConstantAbstract (AbsLitMatrix _ [])) ty) | TypeAny `elem` universe ty = "[]"

-- hack, oh sweet hack!
-- print a domain instead of a type when printing an empty matrix literal.
-- this means we print "int()" instead of "int" inside the index of a matrix type
Expand Down
4 changes: 4 additions & 0 deletions tests/custom/issues/443/443-bool-typed.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
letting s be ([] : `matrix indexed by [int] of bool`)
find a : bool
such that
a = s[1]
4 changes: 4 additions & 0 deletions tests/custom/issues/443/443-bool.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
letting s be []
find a : bool
such that
a = s[1]
4 changes: 4 additions & 0 deletions tests/custom/issues/443/443-workaround.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
letting s be ([] : `matrix indexed by [int] of int`)
find a : int(1..5)
such that
a = s[1]
4 changes: 4 additions & 0 deletions tests/custom/issues/443/443.essence
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
letting s be []
find a : int(1..5)
such that
a = s[1]
15 changes: 15 additions & 0 deletions tests/custom/issues/443/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
rm -rf conjure-output *.solution

conjure solve 443-workaround.essence
head -n6 conjure-output/model000001.eprime

conjure solve 443.essence
head -n6 conjure-output/model000001.eprime

conjure solve 443-bool.essence
head -n6 conjure-output/model000001.eprime

conjure solve 443-bool-typed.essence
head -n6 conjure-output/model000001.eprime

rm -rf conjure-output *.solution
52 changes: 52 additions & 0 deletions tests/custom/issues/443/stdout.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Generating models for 443-workaround.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
No solutions found.
language ESSENCE' 1.0

find a: int(1..5)
branching on [a]
such that a = ([] : `matrix indexed by [int()] of int`)[1]

Generating models for 443.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
No solutions found.
language ESSENCE' 1.0

find a: int(1..5)
branching on [a]
such that a = [][1]

Generating models for 443-bool.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
No solutions found.
language ESSENCE' 1.0

find a: bool
branching on [a]
such that a = [][1]

Generating models for 443-bool-typed.essence
Generated models: model000001.eprime
Saved under: conjure-output
Savile Row: model000001.eprime
Running minion for domain filtering.
Running solver: minion
Copying solution to: 443-bool-typed.solution
language ESSENCE' 1.0

find a: bool
branching on [a]
such that a = false

0 comments on commit dbb092b

Please sign in to comment.