-
Notifications
You must be signed in to change notification settings - Fork 82
Description
Describe the bug
While bringing rascal-lucene up to date with the latest Rascal release, I stumbled upon a situation where the name of a higher-order function was not resolved correctly. I've tried to make this report as concise as possible, but I'm afraid it's still rather large.
The module analysis::text::search::Grammars contains a function isToken (of type bool(Tree)) and a function tokens (with signature list[Tree] tokens(Tree tok, bool(Tree) isToken). Note that the name isToken appears in two scopes. When calling the latter function with yet another function as parameter (i.c.: isComment), the isToken function that was called inside the tokens function did not resolve to isComment, but to (the global) isToken instead.
To Reproduce
- Open the
rascal-luceneproject (v0.1.0) in VS Code with version 0.13.0 of the Rascal extension. - Start a REPL in this project and execute the following and observe that the output of the final two function calls is the same (
isCommentwas executed in both calls totokens).
import IO;
import ParseTree;
import lang::pico::\syntax::Main;
import analysis::text::search::Grammars;
l = |project://rascal-lucene/src/analysis/text/search/testdata/Fac.pico|;
pt = parse(#start[Program], readFile(l));
tokens(pt, isComment)
tokens(pt, isToken)
- Start a new REPL and execute the same commands, swapping the final two. Again, observe that the output is equals; however, it is not the same as in the previous step ((the global)
isTokenwas executed in both calls totokens).
Expected behavior
The output of these function calls should not be equal.
Desktop (please complete the following information):
- VS Code 0.13.0
Additional context
- This behavior was introduced between Rascal
0.41.0-RC76and0.41.0-RC77. In this time, caches around resolution of function names were introduced. - I suspect that the caching around the resolution of
isTokenand/orisCommentis too eager/faulty.