This repository was archived by the owner on Jun 26, 2022. It is now read-only.
Commit 775facb
authored
Improve error message for an invalid rule has syntax (#9)
## What is the goal of this PR?
Users could quite sensibly think that they can assign a type to a variable attribute in a rule `then`. This is not permitted because the type of a variable in the rule `then` has already been determined by the rule `when`. Users should be clearly told what the exact issue is and how to remedy this.
## What are the changes implemented in this PR?
Tell the use the exact type and variable causing the issue and suggest to them to remove the type.
For example:
```
rule people-are-the-same:
when {
$p isa person, has name $n;
} then {
$p has name $n;
};
```
throws error:
```
[TQL31] TypeQL Error: Rule 'people-are-the-same' 'then' '$p has name $n' tries to assign type 'name' to variable 'n', but this variable already had a type assigned by the rule 'when'. Try omitting this type assignment.
```1 parent e13abef commit 775facb
2 files changed
+10
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
| 87 | + | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| |||
0 commit comments