-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem Nesting blocks from static method #109
Comments
Very interesting. I don't really have any idea what would be causing this. You mentioned in discord that it works when the method is an instance method rather than a static method, which pretty much rules out my initial thought of doubly-nested blocks just having issues with closures over the root scope. I'll try to look more into this tomorrow afternoon. |
I wonder if this could be an issue with myst/src/myst/interpreter/nodes/def.cr Lines 4 to 15 in 2fd6706
Maybe |
My suspicion that this has something to do with static vs instance scopes has been furthered by the fact that this works when
Going to properly start looking into this now. |
…r blocks on static methods. `Invocation` was incorrectly determining the value of `self` to use when calling a function. Before myst-lang#131, it was only checking if the Call had a receiver, and would use that value if it did. After myst-lang#131, if the Call did _not_ have a receiver, it would then check if the functor was a closure, and use the closed value of `self` if it was. Now, Invocations _always_ perform both checks, with closures taking higher precedence than Call receivers (though, both will be pushed to the stack if the conditions are met). Before this commit, I was very confused why static methods weren't working while non-static methods were. I assumed it was an issue with `scope` vs `instance_scope` on Types or something like that, but had no idea. Now, though, I'm even more confused how _any_ case was working previously, as the Call receiver was _always_ being pushed as the value of `self`. At least with this version of the code, the value of `self` that will be present is more explicit and well-specified. ¯\_(ツ)_/¯
The follow code raises an error that seems to stem from a scope issue:
Uncaught Exception: No variable or method
ifor Test:Test
The text was updated successfully, but these errors were encountered: