Reputation: 319
For example, in Library.java, there is a HashMap users = new HashMap() and users.put (new Integer(user.getCode()), user);. So I expect the put() method to be in the following set but it returns empty.
rascal> m = createM3FromEclipseProject(elib_dir);
ok
rascal> p = createOFG(elib_dir);
ok
rascal> { m | call(_, _, _, m, _) <- p.statements, method(m, _) <- p.decls}
set[void]: {}
rascal> { m | call(_, _, _, m, _) <- p.statements}
set[void]: {}
Upvotes: 2
Views: 77
Reputation: 6696
It's a common pitfall in pattern matching code in rascal to reuse a variable from the context. In this case m
is already bound and then the match becomes an equality check which always fails. The result is an empty set.
The new type checker can warn for this and you can add types to fresh variables in a pattern to avoid the issue.
Upvotes: 2