-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
interp: fix the detection of builtin calls during parsing
Avoid shortcuts, and apply regular scoping rules for symbol resolution when checking for builtin calls. Fixes #1173.
- Loading branch information
Showing
3 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package main | ||
|
||
var real = func() { println("Hello") } | ||
|
||
func main() { | ||
real() | ||
} | ||
|
||
// Output: | ||
// Hello |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25b570d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mvertes This commit introduced an error in my app (
reflect: call of reflect.Value.Call on ptr Value
) - I'm trying to work out a minimal repro (it's deep in the app somewhere) and will raise an issue when I work it out.25b570d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mvertes I'm struggling to make a small repro for the new error I get starting with this commit. I'll describe the problem in case that helps. I have a struct func that creates a closure that calls a global func - but when that closure is called later on (as part of an event driven system) it panics. The only fix I've found is to make a local copy of the global func inside the struct func and use that in the closure instead of the global func. Oddly this fixes it, it's like the closure somehow loses the global scope and panics when called, but it retains the scope of the struct func where it was created so using a local copy of the global func makes it work again.
I'm really struggling to make a small repro for this. I've coded what I've said above but it doesn't exhibit the same problem, so it may be something in my more complex app that's breaking the global scope somehow. All I can say is it worked before this commit.
I'll keep puzzling over it until I can get a small repro.
25b570d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I finally found a (not simple) repro for this. Reported here: #1206