Skip to content

Commit

Permalink
partial fix to #89 - need to generate extra constraints or add solver…
Browse files Browse the repository at this point in the history
… support
  • Loading branch information
mantkiew committed Jan 11, 2017
1 parent 6c77407 commit 713791d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/Language/Clafer/Generator/Choco.hs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Control.Monad
import Data.Data.Lens
import Data.List
import Data.Maybe
import Data.Ord
import Prelude hiding (exp)
import Language.Clafer.Common
import Language.Clafer.Intermediate.Intclafer
Expand Down Expand Up @@ -107,11 +106,9 @@ genCModule (imodule@IModule{_mDecls}, genv') scopes otherTokens' =
genSuperRefConstraintAssertGoal _ (IEClafer c@IClafer{_uid, _card, _super, _reference, _elements})
= _uid
++ prop "extending" (superOf _uid)
++ (case (getReference c, _reference, _card) of
([target], Just (IReference True _), Just (lb, ub)) -> if lb > 1 || ub > 1 || lb == -1 || ub == -1
then ".refToUnique(" ++ genTarget target ++ ")"
else ".refTo(" ++ genTarget target ++ ")"
([target], Just (IReference _ _), _) -> ".refTo(" ++ genTarget target ++ ")"
++ (case (getReference c, _reference) of
([target], Just (IReference True _)) -> ".refToUnique(" ++ genTarget target ++ ")"
([target], Just (IReference False _)) -> ".refTo(" ++ genTarget target ++ ")"
_ -> "")
++ ";\n"
++ (genSuperRefConstraintAssertGoal _uid =<< _elements)
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
extra-deps:
- data-stringmap-1.0.1.1
- json-builder-0.3
resolver: lts-7.0
resolver: lts-7.15

# for GHC-7.10.3
# extra-deps:
Expand Down
5 changes: 5 additions & 0 deletions test/positive/gi89-ref-to-constant.cfr
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
abstract ASIL -> integer
A : ASIL -> 1
B : ASIL -> 2
C : ASIL -> 3
D : ASIL -> 4

0 comments on commit 713791d

Please sign in to comment.