summaryrefslogtreecommitdiff
path: root/src/compiler/GF
diff options
context:
space:
mode:
authorInari Listenmaa <inari.listenmaa@gmail.com>2020-06-04 19:57:38 +0200
committerInari Listenmaa <inari.listenmaa@gmail.com>2020-06-04 19:57:38 +0200
commitdca1fcd7febf59728819736a08eb572d5d10b3c6 (patch)
tree4624fd8a0547bd9abc829d7a5d458d0168333685 /src/compiler/GF
parentc0714b7d33fa6aeac511406ba3b7b3110860d59f (diff)
Add clarification to Unsupported token gluing (both good and bad case)
Diffstat (limited to 'src/compiler/GF')
-rw-r--r--src/compiler/GF/Compile/Compute/ConcreteNew.hs33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/compiler/GF/Compile/Compute/ConcreteNew.hs b/src/compiler/GF/Compile/Compute/ConcreteNew.hs
index 0edf43c8d..9a8024697 100644
--- a/src/compiler/GF/Compile/Compute/ConcreteNew.hs
+++ b/src/compiler/GF/Compile/Compute/ConcreteNew.hs
@@ -291,9 +291,36 @@ glue env (v1,v2) = glu v1 v2
vt v = case value2term loc (local env) v of
Left i -> Error ('#':show i)
Right t -> t
- in error . render $
- ppL loc (hang "unsupported token gluing:" 4
- (Glue (vt v1) (vt v2)))
+ originalMsg = render $ ppL loc (hang "unsupported token gluing" 4
+ (Glue (vt v1) (vt v2)))
+ term = render $ pp $ Glue (vt v1) (vt v2)
+ in error $ unlines
+ [originalMsg
+ ,""
+ ,"There was a problem in the expression `" ++ term ++ "`"
+ ,"This can be due to two causes, check which one applies in your case."
+ ,""
+ ,"1) You are trying to use + on runtime arguments. Even if you are using"
+ ," `"++term++"` in an oper, make sure that the oper isn't called in a"
+ ," linearization that takes arguments. Both of the following are illegal:"
+ ,""
+ ," lin Test foo bar = foo.s + bar.s <- explicit + in a lin"
+ ," lin Test foo bar = opWithPlus foo bar <- the oper uses +"
+ ,""
+ ,"2) One of the arguments in `"++term++"` is a bound variable"
+ ," from pattern matching a string, but the cases are non-exhaustive."
+ ," Example:"
+ ," case \"test\" of {"
+ ," x + \"a\" => x + \"b\" <- no applicable case for \"test\", so x = ???"
+ ," } ;"
+ ,""
+ ," You can fix this by adding a catch-all case in the end:"
+ ," { x + \"a\" => x + \"b\" ;"
+ ," _ => \"default case\" } ;"
+ ,""
+ ,"3) If neither applies, submit a bug report and we update the error message."
+ ," https://github.com/GrammaticalFramework/gf-core/issues"
+ ]
-- | to get a string from a value that represents a sequence of terminals