Capability checking does not respect name shadowing #389
Labels
Bug
The observed behaviour is incorrect or unexpected.
C-Low Hanging Fruit
Ideal issue for new contributors.
L-Capability checking
Capability checking determines which capabilities are required by a given piece of code.
S-Critical
This is an issue that seriously affects playability or user experience.
Describe the bug
If a lambda happens to shadow a name which is already defined, everything works as it should except that capability checking will attribute the capabilities needed for the existing definition to any uses of the name inside the lambda, even though those uses of the name should refer to the lambda binder, which shadows the existing definition.
To reproduce
Start a new classic mode game. Then type at the REPL:
You will get an error like
build: this would require installing devices you don't have: lambda and calculator
.Expected behavior
Getting an error about
lambda
is expected. However, the error aboutcalculator
is unexpected, since the definition ofbar
neither directly nor indirectly uses any arithmetic. In particular it does not refer tofoo : int
.Additional context
I checked and #373 still has the same issue, it just formats the error message differently. This is expected since the error probably has to do with the capability checker, which #373 did not change.
Marking this as 'Critical' since if you run into this it is very mysterious and hard to figure out what is wrong. It could also completely block you in a situation where you should have the proper devices but the system is telling you that you don't. I ran into this during a playthrough and was completely stumped for a little while.
The text was updated successfully, but these errors were encountered: