Closed bergmanngabor closed 11 years ago
I pushed in a first commit which handles the two cases mentioned by Gábor:
However literals can be an input in normal find-neg find constraints as well: pattern Good(X) { EClass(X); } pattern Bad(X) = { EClass(X); find Good(10); } I'll extend the type validation with this as well. I think there are no more problematic constraints.
"the two cases mentioned by Gábor" I did not mention these two cases in the original bug report (although the specific examples do use such constraints), but rather the following:
"literals can be an input in normal find-neg find constraints " and count find. And count find embedded in count find. And count find embedded in count find embedded in path expression. And so on.
I believe the real problem is that while variables had type inference, other kinds of value expressions did not, even though they are interchangeable in every kind of constraint. I think this is the thing that needs to be fixed.
Sorry if I wasn't clear.
@okrosa please commit everything (tests) and mark as resolved
@okrosa please cherry pick into maintenance branch
Cherry pick completed.
The validator seems to be working fine, however the error message is a bit puzzling (for Gaben's examples):
The types of the literal/computational values are different: EString, EInt. schoolqueries.eiq /school.incquery/src/school line: 17 /school.incquery/src/school/schoolqueries.eiq EMF-IncQuery Problem
Are they really EString and EInt? (I would have expected String and Int).
Note: this is a very minor issue.
I checked my code, and the last commit for the #354 ticket should have solved this issue as well!
Nope, at least it doesn't work in the maintenance branch.
And it also doesn't work in master.
@istvanrath can you give me the example, so I can check the same case? At the moment it should not work in the maintenance branch, but it should in the master. One slight problem that it is quite hard to commit this back to the master, as the #354 ticket is 0.7, not to mention that I refactored the respective class in the 0.7 to finish the #309. Based on that I would leave this issue in the 0.6.9 as is, and rework the message just in the 0.7.
I'm using @bergmanngabor 's example from the description of this issue:
"asd" == count find classesOfTeacher(T2,_SC2);
If you write this inside any of the patterns in the school example, it still gives the EInt, EString error message.
As for the 0.7 vs 0.6.9 question: OK.
Hmm, I get the following error message now (in master):
The types of the literal/computational values are different: java.lang.String, int.
OK, after a full clean and rebuild it also works correctly for me.
Actually it is a small change in 6 places, should I commit it into the maintenance branch?
yes
Ok, should be good in the 0.6.9 as well.
Indeed, I verified and it works now. Thanks, closing.
The following expressions are OK according to the current type checker:
I suggest type inference and the type checker should work for any value, not just variables. Apart from variables, this includes:
count
only)